1463 lines
		
	
	
		
			62 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			1463 lines
		
	
	
		
			62 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using Newtonsoft.Json;
 | |
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Configuration;
 | |
| using System.Data;
 | |
| using System.Data.SqlClient;
 | |
| using System.Linq;
 | |
| using System.Web;
 | |
| using System.Web.UI;
 | |
| using System.Web.UI.WebControls;
 | |
| 
 | |
| namespace FineUIPro.Web.common
 | |
| {
 | |
|     public partial class main_new0 : PageBase
 | |
|     {
 | |
|         protected string VideoURL
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 return ConfigurationManager.AppSettings["Video_URL"]  ;
 | |
|             }
 | |
|         }
 | |
|         protected string PassWord
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 var sysSet17 = (from x in Funs.DB.Sys_Set where x.SetName == "视频监控密码" select x).ToList().FirstOrDefault();
 | |
|                 if (sysSet17 != null)
 | |
|                 {
 | |
| 
 | |
|                     return Funs.EncryptionPassword(sysSet17.SetValue);
 | |
|                 }
 | |
|                 return "";
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         
 | |
|         public static List<Model.Solution_LargerHazard> LargerHazard = new List<Model.Solution_LargerHazard>();
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 公司级项目筛选
 | |
|         /// </summary>
 | |
|         public string[] pids { get; set; }
 | |
|         //页面加载
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 //安监人员数据
 | |
|                 //企业总部总监人数
 | |
|                 Model.SGGLDB db = Funs.DB;
 | |
|                 if (!string.IsNullOrEmpty(CurrUser.CompanyProjectId))
 | |
|                 {
 | |
|                     pids = CurrUser.CompanyProjectId.Split(',');
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     //加载所有在建项目的数据
 | |
|                     var pidArray = Funs.DB.Base_Project.Where(x => x.ProjectState == "1").Select(x => x.ProjectId).ToArray();
 | |
|                     if (pidArray.Length > 0)
 | |
|                     {
 | |
|                         pids = pidArray;
 | |
|                     }
 | |
|                 }
 | |
| 
 | |
|                 var unitId = string.Empty;
 | |
|                 var thisUnit = CommonService.GetIsThisUnit();
 | |
|                 if (thisUnit != null) unitId = thisUnit.UnitId;
 | |
|                 div_qyzbzjrs.InnerHtml = (from x in db.Person_CompanyBranchPerson
 | |
|                                           where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId == unitId
 | |
|                                           select x).Count().ToString();
 | |
| 
 | |
|                 //企业总部专职人数
 | |
|                 div_qyzbzzrs.InnerHtml = (from x in db.Person_CompanyBranchPerson
 | |
|                                           join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId
 | |
|                                           where x.IsOnJob == true && y.IsHsse == true && x.UnitId == unitId
 | |
|                                           select x).Count().ToString();
 | |
| 
 | |
|                 //分支机构总监人数
 | |
|                 div_fzjgzjrs.InnerHtml = (from x in db.Person_CompanyBranchPerson
 | |
|                                           where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId != unitId
 | |
|                                           select x).Count().ToString();
 | |
|                 //分支机构专职人数
 | |
|                 div_fzjgzzrs.InnerHtml = (from x in db.Person_CompanyBranchPerson
 | |
|                                           join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId
 | |
|                                           where x.IsOnJob == true && y.IsHsse == true && x.UnitId != unitId
 | |
|                                           select x).Count().ToString();
 | |
| 
 | |
|                 if (pids == null)
 | |
|                 {
 | |
|                     //项目总监
 | |
|                     div_xmrs.InnerHtml = (from x in db.SitePerson_Person
 | |
|                                           where x.WorkPostId == Const.WorkPost_HSSEDirector && x.IsUsed == true
 | |
|                                           select x).Count().ToString();
 | |
|                     div_qyzbrs1.InnerHtml = div_xmrs.InnerHtml;
 | |
|                     //项目专职
 | |
|                     div_xmzzrs.InnerHtml = (from x in db.SitePerson_Person
 | |
|                                             join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId
 | |
|                                             where y.IsHsse == true && x.IsUsed == true
 | |
|                                             select x).Count().ToString();
 | |
|                     div_qyzbzzrs1.InnerHtml = div_xmzzrs.InnerHtml;
 | |
|                     //企业总部参建人数
 | |
|                     div_qyzbcjrs.InnerHtml = (from x in db.SitePerson_Person
 | |
|                                               where x.IsUsed == true
 | |
|                                               select x).Count().ToString();
 | |
|                     //项目在岗人数
 | |
|                     div_xmcjrs.InnerHtml = (from x in db.SitePerson_Person
 | |
|                                             where x.IsUsed == true && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime.Value > DateTime.Now)
 | |
|                                             select x).Count().ToString();
 | |
| 
 | |
|                     //注安师
 | |
|                     var ZasSql = @"SELECT Person.ProjectId,Project.ProjectCode,Project.ProjectName,Unit.UnitId,Unit.UnitId,Unit.UnitName,
 | |
|                         Person.PersonName,Person.PersonId,Person.IdentityCard,Person.Sex,Person.WorkPostId,WorkPost.WorkPostName,Person.Telephone
 | |
|                         ,(CASE WHEN Sex=2 THEN '女'  WHEN Sex=1 THEN '男' ELSE '' END) AS SexStr
 | |
|                         FROM SitePerson_Person  AS Person
 | |
|                         LEFT JOIN Base_Project AS Project ON Person.ProjectId =Project.ProjectId
 | |
|                         LEFT JOIN Base_Unit AS Unit ON Person.UnitId =Unit.UnitId
 | |
|                         LEFT JOIN Base_WorkPost AS WorkPost ON Person.WorkPostId =WorkPost.WorkPostId
 | |
|                         WHERE IsUsed=1 AND InTime <=GETDATE() AND (OutTime IS NULL OR OutTime > GETDATE()) 
 | |
|                         AND  (SELECT COUNT(*) FROM  QualityAudit_PersonQuality AS Q LEFT JOIN Base_Certificate AS Cer ON Q.CertificateId 
 | |
|                         =Cer.CertificateId WHERE Q.PersonId = Person.PersonId AND IsRegisterHSSE =1) > 0";
 | |
|                     List<SqlParameter> listStr = new List<SqlParameter>();
 | |
|                     SqlParameter[] parameter = listStr.ToArray();
 | |
|                     DataTable tb = SQLHelper.GetDataTableRunText(ZasSql, parameter);
 | |
| 
 | |
|                     div_zasrs.InnerHtml = tb.Rows.Count.ToString();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     //项目总监
 | |
|                     div_xmrs.InnerHtml = (from x in db.SitePerson_Person
 | |
|                                           where x.WorkPostId == Const.WorkPost_HSSEDirector && x.IsUsed == true
 | |
|                                           && pids.Contains(x.ProjectId)
 | |
|                                           select x).Count().ToString();
 | |
|                     //项目专职
 | |
|                     div_xmzzrs.InnerHtml = (from x in db.SitePerson_Person
 | |
|                                             join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId
 | |
|                                             where y.IsHsse == true && x.IsUsed == true
 | |
|                                             && pids.Contains(x.ProjectId)
 | |
|                                             select x).Count().ToString();
 | |
|                     //项目参建人数
 | |
|                     div_qyzbcjrs.InnerHtml = (from x in db.SitePerson_Person
 | |
|                                               where x.IsUsed == true
 | |
|                                               && pids.Contains(x.ProjectId)
 | |
|                                               select x).Count().ToString();
 | |
| 
 | |
|                     //项目在岗人数
 | |
|                     div_xmcjrs.InnerHtml = (from x in db.SitePerson_Person
 | |
|                                             where x.IsUsed == true && pids.Contains(x.ProjectId) && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime.Value > DateTime.Now)
 | |
|                                             select x).Count().ToString();
 | |
| 
 | |
|                     string s1 = string.Format("'{0}'", String.Join(",", pids).Replace(",", "','"));
 | |
| 
 | |
|                     //注安师
 | |
|                     var ZasSql = @"SELECT Person.ProjectId,Project.ProjectCode,Project.ProjectName,Unit.UnitId,Unit.UnitId,Unit.UnitName,
 | |
|                         Person.PersonName,Person.PersonId,Person.IdentityCard,Person.Sex,Person.WorkPostId,WorkPost.WorkPostName,Person.Telephone
 | |
|                         ,(CASE WHEN Sex=2 THEN '女'  WHEN Sex=1 THEN '男' ELSE '' END) AS SexStr
 | |
|                         FROM SitePerson_Person  AS Person
 | |
|                         LEFT JOIN Base_Project AS Project ON Person.ProjectId =Project.ProjectId
 | |
|                         LEFT JOIN Base_Unit AS Unit ON Person.UnitId =Unit.UnitId
 | |
|                         LEFT JOIN Base_WorkPost AS WorkPost ON Person.WorkPostId =WorkPost.WorkPostId
 | |
|                         WHERE IsUsed=1 AND InTime <=GETDATE() AND (OutTime IS NULL OR OutTime > GETDATE()) 
 | |
|                         AND  (SELECT COUNT(*) FROM  QualityAudit_PersonQuality AS Q LEFT JOIN Base_Certificate AS Cer ON Q.CertificateId 
 | |
|                         =Cer.CertificateId WHERE Q.PersonId = Person.PersonId AND IsRegisterHSSE =1) > 0 and  Person.ProjectId in (" + s1 + ")";
 | |
|                     List<SqlParameter> listStr = new List<SqlParameter>();
 | |
|                     SqlParameter[] parameter = listStr.ToArray();
 | |
|                     DataTable tb = SQLHelper.GetDataTableRunText(ZasSql, parameter);
 | |
| 
 | |
|                     div_zasrs.InnerHtml = tb.Rows.Count.ToString();
 | |
| 
 | |
|                     div_qyzbrs1.InnerHtml = div_xmrs.InnerHtml;
 | |
|                     div_qyzbzzrs1.InnerHtml = div_xmzzrs.InnerHtml;
 | |
|                 }
 | |
| 
 | |
| 
 | |
| 
 | |
|                 //项目信息
 | |
|                 getProjectInfo();
 | |
| 
 | |
|                 //安全会议数据
 | |
|                 getSafeMettingCount();
 | |
| 
 | |
|                 //加载项目全部和待整改的
 | |
|                 getProjectYh();
 | |
| 
 | |
|                 getCNEN();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|       
 | |
| 
 | |
|         #region 加载项目信息
 | |
|         protected void getProjectInfo()
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var list = db.Base_Project;
 | |
|                 //在建项目
 | |
|                 div_zjxm.InnerHtml = list.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).Count().ToString();
 | |
|                 //停工项目
 | |
|                 div_tgxm.InnerHtml = list.Where(x => (x.ProjectState == Const.ProjectState_2 || x.ProjectState == null)).Count().ToString();
 | |
|                 //在施危大工程
 | |
|                 div_wdxm.InnerHtml = db.Solution_LargerHazard.Where(x => x.States == Const.State_2).Count().ToString();
 | |
|                 //安全工时数
 | |
|                 //int wHours = Funs.DB.SitePerson_PersonInOutNumber.Max(x => x.WorkHours) ?? 0;
 | |
|                 this.div_safeworktime.InnerHtml = Count3().ToString().Split('.')[0];
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var list = db.Base_Project.Where(x => pids.Contains(x.ProjectId));
 | |
|                 //在建项目
 | |
|                 div_zjxm.InnerHtml = list.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).Count().ToString();
 | |
|                 //停工项目
 | |
|                 div_tgxm.InnerHtml = list.Where(x => (x.ProjectState == Const.ProjectState_2 || x.ProjectState == null)).Count().ToString();
 | |
|                 //在施危大工程
 | |
|                 div_wdxm.InnerHtml = db.Solution_LargerHazard.Where(x => x.States == Const.State_2 && pids.Contains(x.ProjectId)).Count().ToString();
 | |
|                 //安全工时数
 | |
|                 //int wHours = Funs.DB.SitePerson_PersonInOutNumber.Max(x => x.WorkHours) ?? 0;
 | |
|                 this.div_safeworktime.InnerHtml = Count3().ToString().Split('.')[0];
 | |
|             }
 | |
| 
 | |
|         }
 | |
|         #endregion
 | |
|         #region 安全人工时穿透数据
 | |
|         /// <summary>
 | |
|         /// 安全工时数
 | |
|         /// </summary>
 | |
|         /// <param name="state"></param>
 | |
|         /// <returns></returns>
 | |
|         protected decimal Count3()
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             decimal cout1 = 0;
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var getAllPersonInOutList = from x in db.SitePerson_PersonInOutNumber
 | |
|                                             select x;
 | |
|                 if (getAllPersonInOutList.Count() > 0)
 | |
|                 {
 | |
|                     if (getAllPersonInOutList.Count() > 0)
 | |
|                     {
 | |
|                         cout1 = getAllPersonInOutList.Sum(x => (long)x.WorkHours);
 | |
|                     }
 | |
|                 }
 | |
| 
 | |
|                 var getD1 = from x in db.Accident_AccidentHandle
 | |
|                             join y in db.Base_Project on x.ProjectId equals y.ProjectId
 | |
|                             where y.ProjectState == Const.ProjectState_1
 | |
|                             select x;
 | |
|                 var getD2 = from x in db.Accident_AccidentReport
 | |
|                             join y in db.Base_Project on x.ProjectId equals y.ProjectId
 | |
|                             where y.ProjectState == Const.ProjectState_1
 | |
|                             select x;
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|                 if (getD1.Count() > 0)
 | |
|                 {
 | |
|                     cout1 = cout1 - getD1.Sum(x => x.WorkHoursLoss ?? 0);
 | |
|                 }
 | |
|                 if (getD2.Count() > 0)
 | |
|                 {
 | |
|                     cout1 = cout1 - getD2.Sum(x => x.WorkingHoursLoss ?? 0);
 | |
|                 }
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var getAllPersonInOutList = from x in db.SitePerson_PersonInOutNumber
 | |
|                                             where pids.Contains(x.ProjectId)
 | |
|                                             select x;
 | |
|                 if (getAllPersonInOutList.Count() > 0)
 | |
|                 {
 | |
|                     if (getAllPersonInOutList.Count() > 0)
 | |
|                     {
 | |
|                         cout1 = getAllPersonInOutList.Sum(x => (long)x.WorkHours);
 | |
|                     }
 | |
|                 }
 | |
| 
 | |
|                 var getD1 = from x in db.Accident_AccidentHandle
 | |
|                             join y in db.Base_Project on x.ProjectId equals y.ProjectId
 | |
|                             where pids.Contains(x.ProjectId)
 | |
|                             select x;
 | |
|                 var getD2 = from x in db.Accident_AccidentReport
 | |
|                             join y in db.Base_Project on x.ProjectId equals y.ProjectId
 | |
|                             where pids.Contains(x.ProjectId)
 | |
|                             select x;
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|                 if (getD1.Count() > 0)
 | |
|                 {
 | |
|                     cout1 = cout1 - getD1.Sum(x => x.WorkHoursLoss ?? 0);
 | |
|                 }
 | |
|                 if (getD2.Count() > 0)
 | |
|                 {
 | |
|                     cout1 = cout1 - getD2.Sum(x => x.WorkingHoursLoss ?? 0);
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             return cout1;
 | |
|         }
 | |
| 
 | |
|         #endregion
 | |
| 
 | |
|         #region 加载项目全部和待整改的
 | |
|         protected string yhXmmc;
 | |
|         protected string allYhYb;
 | |
|         protected string dzgYhYb;
 | |
| 
 | |
|         protected string allYhZd;
 | |
|         protected string dzgYhZd;
 | |
|         /// <summary>
 | |
|         /// 加载柱状图数据
 | |
|         /// </summary>
 | |
|         /// <param name="type"></param>
 | |
|         protected void getProjectYh()
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             var list = new List<Model.Base_Project>();
 | |
|             if (pids != null)
 | |
|             {
 | |
|                 list = db.Base_Project.Where(x => pids.Contains(x.ProjectId)).ToList();
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 list = db.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).ToList();
 | |
|             }
 | |
|             var hazardRegisters = from x in db.HSSE_Hazard_HazardRegister select x;
 | |
|             if (list.Count > 0)
 | |
|             {
 | |
|                 foreach (var item in list)
 | |
|                 {
 | |
|                     yhXmmc += "'" + item.ShortName + "',";
 | |
|                     //一般
 | |
|                     allYhYb += "'" +
 | |
|                     ((from x in hazardRegisters
 | |
|                       where x.ProjectId == item.ProjectId && x.Risk_Level == "一般" && x.States == "3" &&
 | |
|                             x.CheckTime > Const.DtmarkTime
 | |
|                       select x).Count() +
 | |
|                     (from x in hazardRegisters
 | |
|                      where x.ProjectId == item.ProjectId && x.Risk_Level == "一般" && x.States != "3" &&
 | |
|                            x.CheckTime > Const.DtmarkTime
 | |
|                      select x).Count()) + "',";
 | |
|                     dzgYhYb += "'" + (from x in hazardRegisters
 | |
|                                       where x.ProjectId == item.ProjectId && x.Risk_Level == "一般" && x.States != "3" &&
 | |
|                                             x.CheckTime > Const.DtmarkTime
 | |
|                                       select x).Count() + "',";
 | |
| 
 | |
|                     //重大
 | |
|                     allYhZd += "'" +
 | |
|                        ((from x in hazardRegisters
 | |
|                          where x.ProjectId == item.ProjectId && x.Risk_Level == "重大" && x.States == "3" &&
 | |
|                                x.CheckTime > Const.DtmarkTime
 | |
|                          select x).Count() +
 | |
|                        (from x in hazardRegisters
 | |
|                         where x.ProjectId == item.ProjectId && x.Risk_Level == "重大" && x.States != "3" &&
 | |
|                               x.CheckTime > Const.DtmarkTime
 | |
|                         select x).Count()) +
 | |
|                        "',";
 | |
|                     dzgYhZd += "'" + (from x in hazardRegisters
 | |
|                                       where x.ProjectId == item.ProjectId && x.Risk_Level == "重大" && x.States != "3" &&
 | |
|                                             x.CheckTime > Const.DtmarkTime
 | |
|                                       select x).Count() + "',";
 | |
| 
 | |
|                 }
 | |
|                 yhXmmc = yhXmmc.TrimEnd(',');
 | |
|                 allYhYb = allYhYb.TrimEnd(',');
 | |
|                 dzgYhYb = dzgYhYb.TrimEnd(',');
 | |
|                 allYhZd = allYhZd.TrimEnd(',');
 | |
|                 dzgYhZd = dzgYhZd.TrimEnd(',');
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 安全会议数据
 | |
|         protected void getSafeMettingCount()
 | |
|         {
 | |
|             //企业安委会
 | |
|             div_qyawh.InnerHtml = HSSEData_HSSEService.GetSafetyCommitteeMeetingNum().ToString();
 | |
|             //企业专题
 | |
|             div_qyzt.InnerHtml = HSSEData_HSSEService.GetEnterpriseTopicsMeetingNum().ToString();
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 //项目安全领导小组
 | |
|                 div_xmaqldxz.InnerHtml = Funs.DB.Meeting_SafetyLeaderGroupMeeting.Where(x => x.CompileDate > Const.DtmarkTime).Count().ToString();
 | |
|                 //项目安全例会
 | |
|                 DateTime date = DateTime.Now;
 | |
|                 div_xmalh.InnerHtml = ((from x in Funs.DB.Meeting_WeekMeeting where x.WeekMeetingDate.Value.Year == date.Year && x.WeekMeetingDate.Value.Month == date.Month && x.WeekMeetingDate.Value.Day == date.Day select x).Count()
 | |
|                     + (from x in Funs.DB.Meeting_MonthMeeting where x.MonthMeetingDate.Value.Year == date.Year && x.MonthMeetingDate.Value.Month == date.Month && x.MonthMeetingDate.Value.Day == date.Day select x).Count()).ToString();
 | |
|             }
 | |
|             else
 | |
|             {
 | |
| 
 | |
|                 //项目安全领导小组
 | |
|                 div_xmaqldxz.InnerHtml = Funs.DB.Meeting_SafetyLeaderGroupMeeting.Where(x => x.CompileDate > Const.DtmarkTime
 | |
|                 && pids.Contains(x.ProjectId)).Count().ToString();
 | |
|                 //项目安全例会
 | |
|                 DateTime date = DateTime.Now;
 | |
|                 div_xmalh.InnerHtml = ((from x in Funs.DB.Meeting_WeekMeeting
 | |
|                                         where x.WeekMeetingDate.Value.Year == date.Year && x.WeekMeetingDate.Value.Month == date.Month && x.WeekMeetingDate.Value.Day == date.Day
 | |
|                                         && pids.Contains(x.ProjectId)
 | |
|                                         select x).Count()
 | |
|                     + (from x in Funs.DB.Meeting_MonthMeeting
 | |
|                        where x.MonthMeetingDate.Value.Year == date.Year && x.MonthMeetingDate.Value.Month == date.Month && x.MonthMeetingDate.Value.Day == date.Day
 | |
|                        && pids.Contains(x.ProjectId)
 | |
|                        select x).Count()).ToString();
 | |
| 
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 右侧 安全费用数据、施工机具设备数据、高风险作业许可数据
 | |
|         /// <summary>
 | |
|         ///     获取费用使用(万元)
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetCostUse()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = 0;
 | |
|                 var costs = (from x in Funs.DB.CostGoods_CostSmallDetailItem
 | |
|                              join y in Funs.DB.CostGoods_CostSmallDetail
 | |
|                                  on x.CostSmallDetailId equals y.CostSmallDetailId
 | |
|                              where y.CompileDate > Const.DtmarkTime
 | |
|                              select x.CostMoney ?? 0).ToList().Sum();
 | |
|                 result = Funs.GetNewIntOrZero(costs.ToString().Split('.')[0]);
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = 0;
 | |
|                 var costs = (from x in Funs.DB.CostGoods_CostSmallDetailItem
 | |
|                              join y in Funs.DB.CostGoods_CostSmallDetail
 | |
|                                  on x.CostSmallDetailId equals y.CostSmallDetailId
 | |
|                              where y.CompileDate > Const.DtmarkTime && pids.Contains(y.ProjectId)
 | |
|                              select x.CostMoney ?? 0).ToList().Sum();
 | |
|                 result = Funs.GetNewIntOrZero(costs.ToString().Split('.')[0]);
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取施工机具在用数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetUseEquipmentNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.InApproveManager_EquipmentInItem
 | |
|                               join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId
 | |
|                               where x.IsUsed == true
 | |
|                               select x).Count() +
 | |
|                          (from x in Funs.DB.InApproveManager_GeneralEquipmentInItem
 | |
|                           join y in Funs.DB.InApproveManager_GeneralEquipmentIn on x.GeneralEquipmentInId equals y
 | |
|                               .GeneralEquipmentInId
 | |
|                           where x.IsUsed == true
 | |
|                           select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.InApproveManager_EquipmentInItem
 | |
|                               join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId
 | |
|                               where x.IsUsed == true && pids.Contains(y.ProjectId)
 | |
|                               select x).Count() +
 | |
|                        (from x in Funs.DB.InApproveManager_GeneralEquipmentInItem
 | |
|                         join y in Funs.DB.InApproveManager_GeneralEquipmentIn on x.GeneralEquipmentInId equals y
 | |
|                             .GeneralEquipmentInId
 | |
|                         where x.IsUsed == true && pids.Contains(y.ProjectId)
 | |
|                         select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取施工机具特种设备数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetSpecialEquipmentNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.InApproveManager_EquipmentInItem
 | |
|                               join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId
 | |
|                               where x.IsUsed == true
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.InApproveManager_EquipmentInItem
 | |
|                               join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId
 | |
|                               where x.IsUsed == true && pids.Contains(y.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取作业许可项数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetLicensesNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.License_LicenseManager
 | |
|                               where x.IsHighRisk == true && x.CompileDate > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.License_LicenseManager
 | |
|                               where x.IsHighRisk == true && x.CompileDate > Const.DtmarkTime
 | |
|                                && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取作业许可关闭项数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetLicensesCloseNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.License_LicenseManager
 | |
|                               where x.IsHighRisk == true && x.WorkStates == "3" &&
 | |
|                                     x.CompileDate > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.License_LicenseManager
 | |
|                               where x.IsHighRisk == true && x.WorkStates == "3" &&
 | |
|                                     x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取一般隐患整改闭环项
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetGeneralClosedNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
 | |
|                               where x.Risk_Level == "一般" && x.States == "3" &&
 | |
|                                     x.CheckTime > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
 | |
|                               where x.Risk_Level == "一般" && x.States == "3" &&
 | |
|                                     x.CheckTime > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
| 
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取一般隐患未整改完成项
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetGeneralNotClosedNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
 | |
|                               where x.Risk_Level == "一般" && x.States != "3" &&
 | |
|                                     x.CheckTime > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
 | |
|                               where x.Risk_Level == "一般" && x.States != "3" &&
 | |
|                                     x.CheckTime > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 一般整改率
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public string GetGeneralZgl()
 | |
|         {
 | |
|             var num1 = Math.Round(100.0 * GetGeneralClosedNum() / (GetGeneralClosedNum() + GetGeneralNotClosedNum()), 0).ToString();
 | |
|             return num1;
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取重大隐患整改闭环项
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetMajorClosedNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
 | |
|                               where x.Risk_Level == "重大" && x.States == "3" &&
 | |
|                                     x.CheckTime > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
 | |
|                               where x.Risk_Level == "重大" && x.States == "3" &&
 | |
|                                     x.CheckTime > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取重大隐患未整改完成项
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetMajorNotClosedNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
 | |
|                               where x.Risk_Level == "重大" && x.States != "3" &&
 | |
|                                     x.CheckTime > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
 | |
|                               where x.Risk_Level == "重大" && x.States != "3" &&
 | |
|                                     x.CheckTime > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 重大整改率
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public string GetMajorZgl()
 | |
|         {
 | |
|             var num1 = Math.Round(100.0 * GetMajorClosedNum() / (GetMajorClosedNum() + GetMajorNotClosedNum()), 0).ToString();
 | |
|             if (num1 == "NaN") num1 = "0";
 | |
| 
 | |
| 
 | |
|             return num1;
 | |
|         }
 | |
| 
 | |
|         #region 安全监督检查数据
 | |
|         /// <summary>
 | |
|         ///     获取企业负责人带班检查次数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetCompanyLeadShiftCheckNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 return HSSEData_HSSEService.GetCompanyLeadShiftCheckNum();
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 return HSSEData_HSSEService.GetCompanyLeadShiftCheckNum(pids);
 | |
|             }
 | |
| 
 | |
|         }
 | |
| 
 | |
| 
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取企业综合检查次数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetCompanyComprehensiveCheckNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|                 return HSSEData_HSSEService.GetCompanyComprehensiveCheckNum();
 | |
|             else
 | |
|                 return HSSEData_HSSEService.GetCompanyComprehensiveCheckNum(pids);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取企业专项检查次数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetCompanySpecialCheckNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|                 return HSSEData_HSSEService.GetCompanySpecialCheckNum();
 | |
|             else
 | |
|                 return HSSEData_HSSEService.GetCompanySpecialCheckNum(pids);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取项目负责人带班检查次数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetProjectLeadShiftCheckNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Check_ProjectLeaderCheck
 | |
|                               where x.CompileDate > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Check_ProjectLeaderCheck
 | |
|                               where x.CompileDate > Const.DtmarkTime
 | |
|                                && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
| 
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取项目专项检查次数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetProjectSpecialCheckNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Check_CheckSpecial
 | |
|                               where x.CheckTime > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Check_CheckSpecial
 | |
|                               where x.CheckTime > Const.DtmarkTime
 | |
|                               && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
| 
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取项目专业检查次数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetProjectMajorCheckNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
 | |
|                               where x.CheckTime > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
 | |
|                               where x.CheckTime > Const.DtmarkTime
 | |
|                                  && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 事故事件数据
 | |
|         /// <summary>
 | |
|         ///     获取未遂事件数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetNearMissNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Accident_AccidentPersonRecord
 | |
|                               join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
 | |
|                               where x.IsAttempt == "1" && x.CompileDate > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Accident_AccidentPersonRecord
 | |
|                               join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
 | |
|                               where x.IsAttempt == "1" && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
| 
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取可记录事件数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetRecordableEventNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Accident_AccidentPersonRecord
 | |
|                               join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
 | |
|                               where x.CompileDate > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Accident_AccidentPersonRecord
 | |
|                               join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
 | |
|                               where x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
| 
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取一般事故数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetGeneralAccidentNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Accident_AccidentReport
 | |
|                               where x.AccidentDegree == "1" && x.CompileDate > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Accident_AccidentReport
 | |
|                               where x.AccidentDegree == "1" && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取较大事故数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetMajorAccidentNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Accident_AccidentReport
 | |
|                               where x.AccidentDegree == "2" && x.CompileDate > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Accident_AccidentReport
 | |
|                               where x.AccidentDegree == "2" && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取重大事故数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetSeriousAccidentNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Accident_AccidentReport
 | |
|                               where x.AccidentDegree == "3" && x.CompileDate > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Accident_AccidentReport
 | |
|                               where x.AccidentDegree == "3" && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取特别重大事故数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetSpecialSeriousAccidentNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Accident_AccidentReport
 | |
|                               where x.AccidentDegree == "4"
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Accident_AccidentReport
 | |
|                               where x.AccidentDegree == "4" && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 应急管理数据
 | |
|         /// <summary>
 | |
|         ///     获取企业级综合预案数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetCompanyComprehensivePlanNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
 | |
|                               join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | |
|                               where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime
 | |
|                               select x).Count() +
 | |
|                           (from x in Funs.DB.Emergency_EmergencyList
 | |
|                            join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | |
|                            where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime
 | |
|                            select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
 | |
|                               join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | |
|                               where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count() +
 | |
|                          (from x in Funs.DB.Emergency_EmergencyList
 | |
|                           join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | |
|                           where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                           select x).Count();
 | |
|                 return result;
 | |
| 
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取企业级专项预案数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetCompanySpecialPlanNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
 | |
|                               join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | |
|                               where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime
 | |
|                               select x).Count() +
 | |
|                           (from x in Funs.DB.Emergency_EmergencyList
 | |
|                            join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | |
|                            where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime
 | |
|                            select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
 | |
|                               join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | |
|                               where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count() +
 | |
|                          (from x in Funs.DB.Emergency_EmergencyList
 | |
|                           join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | |
|                           where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                           select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取企业级现场处置预案
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetCompanyOnSiteDisposalPlan()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
 | |
|                               join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | |
|                               where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime
 | |
|                               select x).Count() +
 | |
|                           (from x in Funs.DB.Emergency_EmergencyList
 | |
|                            join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | |
|                            where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime
 | |
|                            select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
 | |
|                               join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | |
|                               where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count() +
 | |
|                          (from x in Funs.DB.Emergency_EmergencyList
 | |
|                           join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | |
|                           where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                           select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取企业级演练次数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetCompanyDrillNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Emergency_DrillRecordList_Unit
 | |
|                               where x.CompileDate > Const.DtmarkTime
 | |
|                               select x).Count() +
 | |
|                           (from x in Funs.DB.Emergency_DrillRecordList
 | |
|                            where x.CompileDate > Const.DtmarkTime
 | |
|                            select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Emergency_DrillRecordList_Unit
 | |
|                               where x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count() +
 | |
|                           (from x in Funs.DB.Emergency_DrillRecordList
 | |
|                            where x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                            select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 安全教育培训人次数数据
 | |
|         /// <summary>
 | |
|         ///     获取三级安全教育培训数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetSafeTrainNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.EduTrain_TrainRecordDetail
 | |
|                               join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId
 | |
|                               join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId
 | |
|                               where y.TrainType == "1"
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.EduTrain_TrainRecordDetail
 | |
|                               join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId
 | |
|                               join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId
 | |
|                               where y.TrainType == "1" && pids.Contains(z.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
| 
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取专项培训数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetSpecialTrainNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.EduTrain_TrainRecordDetail
 | |
|                               join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId
 | |
|                               join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId
 | |
|                               where y.TrainType == "2"
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.EduTrain_TrainRecordDetail
 | |
|                               join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId
 | |
|                               join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId
 | |
|                               where y.TrainType == "2" && pids.Contains(z.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取特种作业培训数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetSpecialOperationTrainNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.EduTrain_TrainRecordDetail
 | |
|                               join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId
 | |
|                               join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId
 | |
|                               where y.TrainType == "3"
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.EduTrain_TrainRecordDetail
 | |
|                               join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId
 | |
|                               join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId
 | |
|                               where y.TrainType == "3" && pids.Contains(z.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 安全数据分析
 | |
|         /// <summary>
 | |
|         ///     获取一般风险数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetGeneralRiskNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Hazard_HazardSelectedItem
 | |
|                               join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
 | |
|                               where y.RiskLevel == 2 && (x.IsStart == true || x.State == "1")
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Hazard_HazardSelectedItem
 | |
|                               join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
 | |
|                               where y.RiskLevel == 2 && (x.IsStart == true || x.State == "1")
 | |
|                                && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取低风险数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetLowRiskNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Hazard_HazardSelectedItem
 | |
|                               join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
 | |
|                               where y.RiskLevel == 1 && (x.IsStart == true || x.State == "1")
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Hazard_HazardSelectedItem
 | |
|                               join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
 | |
|                               where y.RiskLevel == 1 && (x.IsStart == true || x.State == "1")
 | |
|                                && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取中风险数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetMediumRiskNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Hazard_HazardSelectedItem
 | |
|                               join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
 | |
|                               where y.RiskLevel == 3 && (x.IsStart == true || x.State == "1")
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Hazard_HazardSelectedItem
 | |
|                               join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
 | |
|                               where y.RiskLevel == 3 && (x.IsStart == true || x.State == "1")
 | |
|                                 && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取高风险数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetHighRiskNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Hazard_HazardSelectedItem
 | |
|                               join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
 | |
|                               where y.RiskLevel == 4 && (x.IsStart == true || x.State == "1")
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Hazard_HazardSelectedItem
 | |
|                               join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
 | |
|                               where y.RiskLevel == 4 && (x.IsStart == true || x.State == "1")
 | |
|                               && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 应急管理程序
 | |
|         /// <summary>
 | |
|         ///     获取危大工程审批完成数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetCompletedNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.States != "0" && x.IsSuperLargerHazard == false &&
 | |
|                                     x.RecordTime > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.States != "0" && x.IsSuperLargerHazard == false &&
 | |
|                                     x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取危大工程培训人次数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetTrainPersonNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.IsSuperLargerHazard == false && x.TrainPersonNum != null && x.RecordTime > Const.DtmarkTime
 | |
|                               select x.TrainPersonNum).ToList().Sum(x => x.Value);
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.IsSuperLargerHazard == false && x.TrainPersonNum != null && x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x.TrainPersonNum).ToList().Sum(x => x.Value);
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取危大工程施工个数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetConstructionNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.States == "2" && x.IsSuperLargerHazard == false &&
 | |
|                                     x.RecordTime > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.States == "2" && x.IsSuperLargerHazard == false &&
 | |
|                                     x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取危大工程完工个数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetFinishedNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.States == "3" && x.IsSuperLargerHazard == false &&
 | |
|                                     x.RecordTime > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.States == "3" && x.IsSuperLargerHazard == false &&
 | |
|                                     x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取超危大工程审批完成数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetSuperCompletedNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.States != "0" && x.IsSuperLargerHazard == true &&
 | |
|                                     x.RecordTime > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.States != "0" && x.IsSuperLargerHazard == true &&
 | |
|                                     x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取超危大工程培训人次数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetSuperTrainPersonNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result =
 | |
|                 (from x in Funs.DB.Solution_LargerHazard
 | |
|                  where x.IsSuperLargerHazard == true && x.TrainPersonNum != null && x.RecordTime > Const.DtmarkTime
 | |
|                  select x.TrainPersonNum).ToList().Sum(x => x.Value);
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result =
 | |
|               (from x in Funs.DB.Solution_LargerHazard
 | |
|                where x.IsSuperLargerHazard == true && x.TrainPersonNum != null && x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                select x.TrainPersonNum).ToList().Sum(x => x.Value);
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取超危大工程施工个数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetSuperConstructionNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.States == "2" && x.IsSuperLargerHazard == true &&
 | |
|                                     x.RecordTime > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.States == "2" && x.IsSuperLargerHazard == true &&
 | |
|                                     x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///     获取超危大工程完工个数
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public int GetSuperFinishedNum()
 | |
|         {
 | |
|             if (pids == null)
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.States == "3" && x.IsSuperLargerHazard == true &&
 | |
|                                     x.RecordTime > Const.DtmarkTime
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 var result = (from x in Funs.DB.Solution_LargerHazard
 | |
|                               where x.States == "3" && x.IsSuperLargerHazard == true &&
 | |
|                                     x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId)
 | |
|                               select x).Count();
 | |
|                 return result;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 中英文翻译
 | |
|         protected string main_new_rectificationRate = string.Empty;
 | |
|         protected string All = string.Empty;
 | |
|         protected string To_be_rectified = string.Empty;
 | |
|         protected string Accident_event_data = string.Empty;
 | |
|         protected string Emergency_management_data = string.Empty;
 | |
|         protected string Particularly_serious_accident = string.Empty;
 | |
|         protected string General_accident = string.Empty;
 | |
|         protected string Major_accident = string.Empty;
 | |
|         protected string Relatively_major_accident = string.Empty;
 | |
|         protected string High_risk = string.Empty;
 | |
|         protected string Medium_risk = string.Empty;
 | |
|         protected string LowRisk = string.Empty;
 | |
|         protected string GeneralRisk = string.Empty;
 | |
|         protected void getCNEN()
 | |
|         {
 | |
|             main_new_rectificationRate = Resources.Lan.main_new_rectificationRate;
 | |
|             All = Resources.Lan.All;
 | |
|             To_be_rectified = Resources.Lan.To_be_rectified;
 | |
|             Accident_event_data = Resources.Lan.Accident_event_data;
 | |
|             Emergency_management_data = Resources.Lan.Emergency_management_data;
 | |
|             Particularly_serious_accident = Resources.Lan.Particularly_serious_accident;
 | |
|             General_accident = Resources.Lan.General_accident;
 | |
|             Major_accident = Resources.Lan.Major_accident;
 | |
|             Relatively_major_accident = Resources.Lan.Relatively_major_accident;
 | |
|             High_risk = Resources.Lan.High_risk;
 | |
|             Medium_risk = Resources.Lan.Medium_risk;
 | |
|             LowRisk = Resources.Lan.LowRisk;
 | |
|             GeneralRisk = Resources.Lan.GeneralRisk;
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |