3231 lines
152 KiB
C#
3231 lines
152 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using BLL;
|
||
using Newtonsoft.Json.Linq;
|
||
using System.Threading;
|
||
using Model;
|
||
|
||
namespace FineUIPro.Web.HSSE.Manager
|
||
{
|
||
public partial class ManagerMonthCEdit : PageBase
|
||
{
|
||
#region 定义项
|
||
/// <summary>
|
||
/// 主键
|
||
/// </summary>
|
||
public string MonthReportId
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["MonthReportId"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["MonthReportId"] = value;
|
||
}
|
||
}
|
||
|
||
public string AddOrUpdate
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["AddOrUpdate"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["AddOrUpdate"] = value;
|
||
}
|
||
}
|
||
|
||
public string ProjectId { get; set; }
|
||
|
||
private static DateTime months;
|
||
|
||
private static DateTime startTime;
|
||
|
||
private static DateTime endTime;
|
||
|
||
private static DateTime yearStartTime;
|
||
|
||
private static DateTime projectStartTime;
|
||
#endregion
|
||
|
||
#region list集合
|
||
public List<Model.Base_Unit> unitList = new List<Model.Base_Unit>();
|
||
|
||
/// <summary>
|
||
/// 培训情况集合
|
||
/// </summary>
|
||
private static List<Model.Manager_TrainSortC> trainSorts = new List<Model.Manager_TrainSortC>();
|
||
|
||
/// <summary>
|
||
/// 4.2检查情况集合
|
||
/// </summary>
|
||
private static List<Model.Manager_CheckSortC> checkSorts = new List<Model.Manager_CheckSortC>();
|
||
|
||
/// <summary>
|
||
/// HSE奖励与处罚
|
||
/// </summary>
|
||
private static List<Model.Manager_RewardAndPunishSortC> rewardAndPunishSortCs = new List<Model.Manager_RewardAndPunishSortC>();
|
||
|
||
/// <summary>
|
||
/// 4.5项目本月危大工程管理数据
|
||
/// </summary>
|
||
private static List<MonthHazardous> monthHazardousList = new List<MonthHazardous>();
|
||
|
||
/// <summary>
|
||
/// 4.6.1 应急预案发布情况
|
||
/// </summary>
|
||
private static List<Model.Manager_EmergencyPlan> emergencyPlanList = new List<Model.Manager_EmergencyPlan>();
|
||
|
||
/// <summary>
|
||
/// 4.6.2 应急演练工作情况说明
|
||
/// </summary>
|
||
private static List<Manager_DrillRecordList> drillRecordList = new List<Manager_DrillRecordList>();
|
||
|
||
/// <summary>
|
||
/// 4.10 HSE现场其他管理情况集合
|
||
/// </summary>
|
||
private static List<Model.Manager_Month_OtherManagementC> otherManagements = new List<Model.Manager_Month_OtherManagementC>();
|
||
|
||
/// <summary>
|
||
/// 5.1 五环HSE费用投入集合
|
||
/// </summary>
|
||
private static List<Model.Manager_Month_FiveExpenseC> fiveExpenses = new List<Model.Manager_Month_FiveExpenseC>();
|
||
|
||
/// <summary>
|
||
/// 6.3HSE目标实现情况
|
||
/// </summary>
|
||
private static List<Galach> galachList = new List<Galach>();
|
||
|
||
/// <summary>
|
||
/// 7.1 其他HSE工作计划
|
||
/// </summary>
|
||
private static List<Model.Manager_Month_OtherWorkPlanC> otherWorkPlanCs = new List<Model.Manager_Month_OtherWorkPlanC>();
|
||
|
||
/// <summary>
|
||
/// 8 HSE合规义务识别与评价表
|
||
/// </summary>
|
||
private static List<Model.Manager_Month_ComplianceObligationsC> complianceObligationsCs = new List<Model.Manager_Month_ComplianceObligationsC>();
|
||
|
||
/// <summary>
|
||
/// 本月伤害事故统计
|
||
/// </summary>
|
||
private static List<Model.Manager_Month_InjuryAccidentC> injuryAccidents = new List<Model.Manager_Month_InjuryAccidentC>();
|
||
|
||
#endregion
|
||
|
||
public List<Project_ProjectUnit> units = new List<Project_ProjectUnit>();
|
||
|
||
public Model.SGGLDB db = Funs.DB;
|
||
|
||
#region 实体类
|
||
/// <summary>
|
||
/// 项目本月危大工程管理数据
|
||
/// </summary>
|
||
public class MonthHazardous
|
||
{
|
||
public string Id { get; set; }
|
||
|
||
public string Category { get; set; }
|
||
|
||
public int ExpertCount { get; set; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 6.3 实体类
|
||
/// </summary>
|
||
public class Galach
|
||
{
|
||
public string Id { get; set; }
|
||
public string GoName { get; set; }
|
||
public decimal GoTarget { get; set; }
|
||
public string GoValue { get; set; }
|
||
}
|
||
#endregion
|
||
|
||
#region 加载页面
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
ProjectId = CurrUser.LoginProjectId;
|
||
units = (from x in db.Project_ProjectUnit
|
||
where x.ProjectId == this.ProjectId && (x.UnitType == "1" || x.UnitType == "2")
|
||
orderby x.UnitType
|
||
select x).ToList(); //1为总包,2为施工分包
|
||
|
||
rewardAndPunishSortCs.Clear();
|
||
trainSorts.Clear();
|
||
checkSorts.Clear();
|
||
otherManagements.Clear();
|
||
fiveExpenses.Clear();
|
||
otherWorkPlanCs.Clear();
|
||
complianceObligationsCs.Clear();
|
||
monthHazardousList.Clear();
|
||
emergencyPlanList.Clear();
|
||
drillRecordList.Clear();
|
||
injuryAccidents.Clear();
|
||
galachList.Clear();
|
||
|
||
unitList = db.Base_Unit.ToList();
|
||
MonthReportId = Request.Params["MonthReportId"];
|
||
var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||
|
||
if (!string.IsNullOrEmpty(MonthReportId))
|
||
{
|
||
var model = db.Manager_MonthReportC.FirstOrDefault(x => x.MonthReportId == MonthReportId);
|
||
if (model != null)
|
||
{
|
||
if (model.MonthReportCode != null)
|
||
{
|
||
this.txtPeriod.Text = Convert.ToString(model.MonthReportCode);
|
||
}
|
||
if (model.Months != null)
|
||
{
|
||
txtReportMonths.Text = string.Format("{0:yyyy-MM}", model.Months);
|
||
months = Convert.ToDateTime(model.Months);
|
||
}
|
||
if (model.StartDate != null)
|
||
{
|
||
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", model.StartDate);
|
||
}
|
||
if (model.EndDate != null)
|
||
{
|
||
this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", model.EndDate);
|
||
}
|
||
}
|
||
AddOrUpdate = "update";
|
||
|
||
#region 3.本月项目现场HSE人工日统计
|
||
//本月项目现场HSE人工日统计
|
||
Model.MonthReportCHSEDay hseDay = new Model.MonthReportCHSEDay
|
||
{
|
||
MonthHSEDay = model.MonthHSEDay ?? 0,
|
||
SumHSEDay = model.SumHSEDay ?? 0,
|
||
MonthHSEWorkDay = model.MonthHSEWorkDay ?? 0,
|
||
YearHSEWorkDay = model.YearHSEWorkDay ?? 0,
|
||
SumHSEWorkDay = model.SumHSEWorkDay ?? 0,
|
||
HseManhours = model.HseManhours ?? 0,
|
||
SubcontractManHours = model.SubcontractManHours ?? 0,
|
||
TotalHseManhoursYear = model.TotalHseManhoursYear ?? 0,
|
||
TotalHseManhours = model.TotalHseManhours ?? 0
|
||
};
|
||
List<Model.MonthReportCHSEDay> list = new List<Model.MonthReportCHSEDay>();
|
||
list.Add(hseDay);
|
||
this.gvHSEDay.DataSource = list;
|
||
this.gvHSEDay.DataBind();
|
||
#endregion
|
||
|
||
#region 4.1 培训情况
|
||
//培训情况
|
||
var trainSorts = BLL.TrainSortCService.GetTrainSortsByMonthReportId(MonthReportId);
|
||
if (trainSorts.Count > 0)
|
||
{
|
||
this.gvTrainSort.DataSource = trainSorts;
|
||
this.gvTrainSort.DataBind();
|
||
|
||
if (this.gvTrainSort.Rows.Count > 0)
|
||
{
|
||
JObject summary = new JObject();
|
||
summary.Add("TrainType", "培训人数合计:");
|
||
summary.Add("TotalPersonNum", trainSorts.Sum(x => x.TotalPersonNum));
|
||
this.gvTrainSort.SummaryData = summary;
|
||
}
|
||
else
|
||
{
|
||
this.gvTrainSort.SummaryData = null;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 4.2现场HSE会议及检查统计
|
||
//检查情况
|
||
checkSorts = BLL.CheckSortCService.GetCheckSortsByMonthReportId(MonthReportId);
|
||
if (checkSorts.Count > 0)
|
||
{
|
||
this.gvCheckSort.DataSource = checkSorts;
|
||
this.gvCheckSort.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region 4.3隐患
|
||
txtMonthHdangerCount.Text = model.MonthHdangerCount.ToString();
|
||
txtYearHdangerCount.Text = model.YearHdangerCount.ToString();
|
||
#endregion
|
||
|
||
#region 4.4 本月项目作业许可管理数据
|
||
var PModel = db.Manager_ProjectAssignment.FirstOrDefault(x => x.MonthReportId == MonthReportId);
|
||
if (PModel != null)
|
||
{
|
||
nbFireWorkCount.Text = PModel.FireWorkCount.ToString();
|
||
nbBreakGroundCount.Text = PModel.BreakGroundCount.ToString();
|
||
nbLimitedSpaceCount.Text = PModel.LimitedSpaceCount.ToString();
|
||
nbElectricityCount.Text = PModel.ElectricityCount.ToString();
|
||
nbHeightWorkCount.Text = PModel.HeightWorkCount.ToString();
|
||
nbRadialWork.Text = PModel.RadialWork.ToString();
|
||
nbLiftingWorkCount.Text = PModel.LiftingWorkCount.ToString();
|
||
nbNightWork.Text = PModel.NightWork.ToString();
|
||
nbMonthCount.Text = PModel.MonthCount.ToString();
|
||
nbYearCount.Text = PModel.YearCount.ToString();
|
||
nbProCount.Text = PModel.ProCount.ToString();
|
||
}
|
||
#endregion
|
||
|
||
#region 4.5项目本月危大工程管理数据
|
||
if (!string.IsNullOrEmpty(model.MonthExpertNoCount.ToString()))
|
||
{
|
||
var MonthExpertmodel = new MonthHazardous()
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
Category = "非经专家论证的危大工程数量",
|
||
ExpertCount = Convert.ToInt32(model.MonthExpertNoCount)
|
||
};
|
||
monthHazardousList.Add(MonthExpertmodel);
|
||
}
|
||
if (!string.IsNullOrEmpty(model.MonthExpertCount.ToString()))
|
||
{
|
||
var MonthExpertmodel = new MonthHazardous()
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
Category = "经专家论证的危大工程数量",
|
||
ExpertCount = Convert.ToInt32(model.MonthExpertCount)
|
||
};
|
||
monthHazardousList.Add(MonthExpertmodel);
|
||
}
|
||
|
||
|
||
if (monthHazardousList.Count > 0)
|
||
{
|
||
MonthHazardousGrid.DataSource = monthHazardousList;
|
||
MonthHazardousGrid.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region 4.6.1 应急预案发布情况
|
||
emergencyPlanList = db.Manager_EmergencyPlan.Where(x => x.MonthReportId == MonthReportId).OrderBy(x => x.SortIndex).ToList();
|
||
if (emergencyPlanList.Count > 0)
|
||
{
|
||
EmergencyPlanGrid.DataSource = emergencyPlanList;
|
||
EmergencyPlanGrid.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region 4.6.2 应急演练工作情况说明
|
||
drillRecordList = db.Manager_DrillRecordList.Where(x => x.MonthReportId == MonthReportId).OrderBy(x => x.Ddate).ToList();
|
||
if (drillRecordList.Count > 0)
|
||
{
|
||
DrillRecordListGrid.DataSource = drillRecordList;
|
||
DrillRecordListGrid.DataBind();
|
||
}
|
||
else {
|
||
DrillRecordListGrid.EmptyText = "<raw><div class=\"grid-empty-text\">暂无数据</div></raw>";
|
||
}
|
||
#endregion
|
||
|
||
#region 4.6.3其他应急管理工作描述
|
||
txtEmergencyManagementWorkDef.Text = model.EmergencyManagementWorkDef;
|
||
#endregion
|
||
|
||
#region 4.7HSE奖励与处罚
|
||
//HSE奖励与处罚
|
||
rewardAndPunishSortCs = BLL.RewardAndPunishSortCService.GetRewardAndPunishSortCByMontReportId(MonthReportId);
|
||
if (rewardAndPunishSortCs.Count > 0)
|
||
{
|
||
this.gvRewardSortAndPunish.DataSource = rewardAndPunishSortCs;
|
||
this.gvRewardSortAndPunish.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region 4.8HSE现场其他管理情况
|
||
otherManagements = BLL.OtherManagementCService.GetOtherManagementByMonthReportId(this.MonthReportId);
|
||
if (otherManagements.Count > 0)
|
||
{
|
||
this.gvOtherManagement.DataSource = otherManagements;
|
||
this.gvOtherManagement.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region 5.1 本月项目HSE费用投入统计
|
||
fiveExpenses = BLL.FiveExpenseCService.GetFiveExpenseByMonthReportId(MonthReportId);
|
||
if (fiveExpenses.Count > 0)
|
||
{
|
||
this.gvFiveExpenseC.DataSource = fiveExpenses;
|
||
this.gvFiveExpenseC.DataBind();
|
||
OutputgvFiveExpenseCSummaryData();
|
||
}
|
||
#endregion
|
||
|
||
#region 6.1未遂事件统计
|
||
var attemptedModel = db.Manager_Attempted.FirstOrDefault(x => x.MonthReportId == MonthReportId);
|
||
if (attemptedModel != null)
|
||
{
|
||
nbWhMonthNum.Text = attemptedModel.WhMonthNum.ToString();
|
||
nbWhYearNum.Text = attemptedModel.WhYearNum.ToString();
|
||
nbFbsMonthNum.Text = attemptedModel.FbsMonthNum.ToString();
|
||
nbFbsYearNum.Text = attemptedModel.FbsYearNum.ToString();
|
||
nbProNum.Text = attemptedModel.ProNum.ToString();
|
||
}
|
||
#endregion
|
||
|
||
#region 6.1 2 本月伤害事故统计
|
||
injuryAccidents = BLL.InjuryAccidentCService.GetInjuryAccidentCByMonthReportId(this.MonthReportId);
|
||
if (injuryAccidents.Count > 0)
|
||
{
|
||
this.gvInjuryAccident.DataSource = injuryAccidents;
|
||
this.gvInjuryAccident.DataBind();
|
||
OutputSummaryData();
|
||
}
|
||
#endregion
|
||
|
||
#region 6.2 HSE责任事故/事件描述
|
||
|
||
//6.2 HSE责任事故/事件描述
|
||
txtDef.Text = model.AccidentDef;
|
||
#endregion
|
||
|
||
#region 6.3 HSE目标实现情况
|
||
if (!string.IsNullOrEmpty(model.Goalach1.ToString()))
|
||
{
|
||
var GalachModel = new Galach()
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
GoName = "项目HSE检查计划完成率",
|
||
GoTarget = Convert.ToDecimal(model.Goalach1.ToString()),
|
||
GoValue = "≥90%"
|
||
|
||
};
|
||
galachList.Add(GalachModel);
|
||
}
|
||
if (!string.IsNullOrEmpty(model.Goalach2.ToString()))
|
||
{
|
||
var GalachModel = new Galach()
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
GoName = "百万工时总可记录事件率<br/>(总可记录事件人数 / 总工时)×106",
|
||
GoTarget = Convert.ToDecimal(model.Goalach2.ToString()),
|
||
GoValue = "≤2"
|
||
|
||
};
|
||
galachList.Add(GalachModel);
|
||
}
|
||
if (!string.IsNullOrEmpty(model.Goalach3.ToString()))
|
||
{
|
||
var GalachModel = new Galach()
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
GoName = "百万工时事故发生频率<br/>(损失工时伤害事故起数 / 总工时)×106",
|
||
GoTarget = Convert.ToDecimal(model.Goalach3.ToString()),
|
||
GoValue = "≤15"
|
||
|
||
};
|
||
galachList.Add(GalachModel);
|
||
}
|
||
if (galachList.Count > 0)
|
||
{
|
||
GoalachGrid.DataSource = galachList;
|
||
GoalachGrid.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region 7.1下个月工作计划
|
||
otherWorkPlanCs = BLL.OtherWorkPlanCService.GetOtherWorkPlanByMonthReportId(MonthReportId);
|
||
if (otherWorkPlanCs.Count > 0)
|
||
{
|
||
this.gvOtherWorkPlanC.DataSource = otherWorkPlanCs;
|
||
this.gvOtherWorkPlanC.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region 8合规义务识别与评价
|
||
complianceObligationsCs = (from x in Funs.DB.Manager_Month_ComplianceObligationsC where x.MonthReportId == this.MonthReportId select x).ToList();
|
||
if (complianceObligationsCs.Count > 0)
|
||
{
|
||
this.gvOperateComplianceObligations.DataSource = complianceObligationsCs;
|
||
this.gvOperateComplianceObligations.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
//9问题
|
||
txtQuestion.Text = model.Question;
|
||
|
||
//加载所有grid
|
||
lodAllGrid("1");
|
||
}
|
||
else
|
||
{
|
||
MonthReportId = Guid.NewGuid().ToString();
|
||
months = Convert.ToDateTime(Request.Params["months"]);
|
||
this.txtReportMonths.Text = string.Format("{0:yyyy-MM}", months);
|
||
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddMonths(-1));
|
||
if (!string.IsNullOrEmpty(Request.Params["startdate"]))
|
||
{
|
||
txtStartDate.Text = Request.Params["startdate"];
|
||
}
|
||
|
||
this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||
if (!string.IsNullOrEmpty(Request.Params["enddate"]))
|
||
{
|
||
txtEndDate.Text = Request.Params["enddate"];
|
||
}
|
||
|
||
this.txtPeriod.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectManagerMonthCMenuId, this.ProjectId, this.CurrUser.UnitId);
|
||
AddOrUpdate = "add";
|
||
startTime = Convert.ToDateTime(txtStartDate.Text);
|
||
endTime = Convert.ToDateTime(txtEndDate.Text);
|
||
|
||
yearStartTime = Convert.ToDateTime(startTime.ToString("yyyy-01-01"));
|
||
|
||
if (project.StartDate != null)
|
||
{
|
||
projectStartTime = Convert.ToDateTime(project.StartDate);
|
||
}
|
||
//加载所有grid
|
||
lodAllGrid("0");
|
||
}
|
||
|
||
#region 加载1.项目概况
|
||
|
||
var mainUnit = BLL.UnitService.GetThisUnitDropDownList()[0];
|
||
this.lbProjectName.Text = project.ProjectName;
|
||
if (mainUnit != null)
|
||
{
|
||
this.lblMainUnitName.Text = mainUnit.UnitName;
|
||
}
|
||
this.lblProjectAddress.Text = project.ProjectAddress;
|
||
this.lblProjectCode.Text = project.ProjectCode;
|
||
this.lblContractNo.Text = project.ContractNo; //合同号
|
||
if (!string.IsNullOrEmpty(project.ProjectType))
|
||
{
|
||
var c = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_ProjectType).
|
||
FirstOrDefault(x => x.ID == project.ProjectType);
|
||
if (c != null)
|
||
{
|
||
this.lblProjectType.Text = c.ConstText;
|
||
}
|
||
}
|
||
this.lblWorkRange.Text = project.WorkRange;//工程范围
|
||
if (project.Duration != null)
|
||
{
|
||
this.lblDuration.Text = project.Duration.ToString();//工期(月)
|
||
}
|
||
if (project.StartDate != null)
|
||
{
|
||
this.lblStartDate.Text = string.Format("{0:yyyy-MM-dd}", project.StartDate);
|
||
}
|
||
if (project.EndDate != null)
|
||
{
|
||
this.lblEndDate.Text = string.Format("{0:yyyy-MM-dd}", project.EndDate);
|
||
}
|
||
#endregion
|
||
|
||
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 时间选择事件
|
||
/// <summary>
|
||
/// 开始时间选择事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void txtStartDate_TextChanged(object sender, EventArgs e)
|
||
{
|
||
if (!string.IsNullOrEmpty(this.txtStartDate.Text.Trim()))
|
||
{
|
||
string url = Request.Url.ToString();
|
||
if (url.Contains("?"))
|
||
{
|
||
url = Request.Url.ToString().Substring(0, Request.Url.ToString().LastIndexOf('?'));
|
||
}
|
||
Response.Redirect(url + "?months=" + months + "&startdate=" + txtStartDate.Text + "&enddate=" + txtEndDate.Text);
|
||
}
|
||
}
|
||
|
||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||
{
|
||
if (!string.IsNullOrEmpty(this.txtStartDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtEndDate.Text.Trim()))
|
||
{
|
||
if (Funs.GetNewDateTime(this.txtStartDate.Text.Trim()) > Funs.GetNewDateTime(this.txtEndDate.Text.Trim()))
|
||
{
|
||
Alert.ShowInTop("开始时间不能大于结束时间!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
PageContext.RegisterStartupScript("refresh();");
|
||
}
|
||
}
|
||
|
||
protected void btnLoad_Click(object sender, EventArgs e)
|
||
{
|
||
startTime = Convert.ToDateTime(string.Format("{0:yyyy-MM-dd}", txtStartDate.Text));
|
||
endTime = Convert.ToDateTime(string.Format("{0:yyyy-MM-dd}", txtEndDate.Text));
|
||
if (AddOrUpdate == "update")
|
||
{
|
||
lodAllGrid("1");
|
||
PageContext.RegisterStartupScript("rehiden();");
|
||
}
|
||
else
|
||
{
|
||
lodAllGrid("0");
|
||
PageContext.RegisterStartupScript("rehiden();");
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 保存
|
||
protected void btnSave_Click(object sender, EventArgs e)
|
||
{
|
||
#region 保存主表
|
||
string MonthHSEDay = string.Empty, SumHSEDay = string.Empty, MonthHSEWorkDay = string.Empty, YearHSEWorkDay = string.Empty, SumHSEWorkDay = string.Empty,
|
||
HseManhours = string.Empty, SubcontractManHours = string.Empty, TotalHseManhours = string.Empty, TotalYearHseManhours = string.Empty;
|
||
JArray mergedData = gvHSEDay.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
string status = mergedRow.Value<string>("status");
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
MonthHSEDay = values.Value<string>("MonthHSEDay").ToString();
|
||
SumHSEDay = values.Value<string>("SumHSEDay").ToString();
|
||
MonthHSEWorkDay = values.Value<string>("MonthHSEWorkDay").ToString();
|
||
YearHSEWorkDay = values.Value<string>("YearHSEWorkDay").ToString();
|
||
SumHSEWorkDay = values.Value<string>("SumHSEWorkDay").ToString();
|
||
HseManhours = values.Value<string>("HseManhours").ToString();
|
||
SubcontractManHours = values.Value<string>("SubcontractManHours").ToString();
|
||
TotalYearHseManhours = values.Value<string>("TotalHseManhoursYear").ToString();
|
||
TotalHseManhours = values.Value<string>("TotalHseManhours").ToString();
|
||
}
|
||
|
||
var monthReport = new Model.Manager_MonthReportC();
|
||
monthReport.MonthReportId = MonthReportId;
|
||
monthReport.ProjectId = this.CurrUser.LoginProjectId;
|
||
monthReport.MonthReportCode = txtPeriod.Text;
|
||
monthReport.Months = months;
|
||
monthReport.ReportMan = this.CurrUser.UserId;
|
||
monthReport.MonthReportDate = DateTime.Now;
|
||
|
||
monthReport.StartDate = Funs.GetNewDateTime(txtStartDate.Text);
|
||
monthReport.EndDate = Funs.GetNewDateTime(txtEndDate.Text);
|
||
|
||
monthReport.MonthHSEDay = Funs.GetNewIntOrZero(MonthHSEDay);
|
||
monthReport.SumHSEDay = Funs.GetNewIntOrZero(SumHSEDay);
|
||
monthReport.MonthHSEWorkDay = Funs.GetNewIntOrZero(MonthHSEWorkDay);
|
||
monthReport.YearHSEWorkDay = Funs.GetNewIntOrZero(YearHSEWorkDay);
|
||
monthReport.SumHSEWorkDay = Funs.GetNewIntOrZero(SumHSEWorkDay);
|
||
monthReport.HseManhours = Funs.GetNewIntOrZero(HseManhours);
|
||
monthReport.SubcontractManHours = Funs.GetNewIntOrZero(SubcontractManHours);
|
||
monthReport.TotalHseManhours = Funs.GetNewIntOrZero(TotalHseManhours);
|
||
monthReport.TotalHseManhoursYear = Funs.GetNewIntOrZero(TotalYearHseManhours);
|
||
|
||
//4.3隐患
|
||
monthReport.MonthHdangerCount = Funs.GetNewIntOrZero(txtMonthHdangerCount.Text);
|
||
monthReport.YearHdangerCount = Funs.GetNewIntOrZero(txtYearHdangerCount.Text);
|
||
|
||
#region 4.5项目本月危大工程管理数据
|
||
JArray MonthHazardousmergedData = MonthHazardousGrid.GetMergedData();
|
||
foreach (JObject mergedRow in MonthHazardousmergedData)
|
||
{
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
|
||
var Category = values.Value<string>("Category").ToString();
|
||
if (Category == "经专家论证的危大工程数量")
|
||
{
|
||
monthReport.MonthExpertCount = Funs.GetNewInt(values.Value<string>("ExpertCount").ToString());
|
||
}
|
||
else
|
||
{
|
||
monthReport.MonthExpertNoCount = Funs.GetNewInt(values.Value<string>("ExpertCount").ToString());
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
//4.6.3其他应急管理工作描述
|
||
monthReport.EmergencyManagementWorkDef = txtEmergencyManagementWorkDef.Text;
|
||
|
||
//6.2HSE责任事故/事件描述
|
||
monthReport.AccidentDef = txtDef.Text;
|
||
|
||
#region 6.3HSE目标实现情况
|
||
JArray GoalachData = GoalachGrid.GetMergedData();
|
||
foreach (JObject mergedRow in GoalachData)
|
||
{
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
|
||
var GoValue = values.Value<string>("GoValue").ToString();
|
||
if (GoValue == "≥90%")
|
||
{
|
||
monthReport.Goalach1 = Funs.GetNewDecimalOrZero(values.Value<string>("GoTarget").ToString());
|
||
}
|
||
else if (GoValue == "≤2")
|
||
{
|
||
monthReport.Goalach2 = Funs.GetNewDecimalOrZero(values.Value<string>("GoTarget").ToString());
|
||
}
|
||
else
|
||
{
|
||
monthReport.Goalach3 = Funs.GetNewDecimalOrZero(values.Value<string>("GoTarget").ToString());
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
//9.问题
|
||
monthReport.Question = txtQuestion.Text;
|
||
monthReport.MonthReportType = "1";
|
||
if (AddOrUpdate == "add")
|
||
{
|
||
|
||
MonthReportCService.AddMonthReport(monthReport);
|
||
}
|
||
else
|
||
{
|
||
MonthReportCService.UpdateMonthReport(monthReport);
|
||
}
|
||
#endregion
|
||
#region 保存所有子表
|
||
//2
|
||
OperatePersonSort();
|
||
|
||
//4.1
|
||
OperateTrainSort();
|
||
|
||
//4.2
|
||
OperateCheckSort();
|
||
|
||
//4.3
|
||
OperateManager_HiddenDanger();
|
||
|
||
//4.4
|
||
OperateProjectAssignment();
|
||
|
||
//4.6.1
|
||
OperateEmergencyPlan();
|
||
|
||
//4.6.2
|
||
OperateDrillRecordList();
|
||
|
||
//4.7
|
||
OperateRewardAndPunishSort();
|
||
|
||
//4.8
|
||
OperateOtherManagementSort();
|
||
|
||
//5.1
|
||
OperateFiveExpenseSort();
|
||
|
||
//6.1未遂事件统计
|
||
OperateAttempted();
|
||
|
||
//6.1 2本月伤害事故统计
|
||
OperateInjuryAccidentSort();
|
||
|
||
//7.1
|
||
OperateOtherWorkPlanCSort();
|
||
|
||
//8
|
||
OperateComplianceObligationsCSort();
|
||
|
||
//10
|
||
SaveImages();
|
||
#endregion
|
||
|
||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||
}
|
||
|
||
#region 2.保存人力投入情况
|
||
private void OperatePersonSort()
|
||
{
|
||
PersonSortCService.DeletePersonSortsByMonthReportId(MonthReportId);
|
||
JArray mergedData = gvPersonSort.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
string status = mergedRow.Value<string>("status");
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
int i = mergedRow.Value<int>("index");
|
||
Model.Manager_PersonSortC personSort = new Model.Manager_PersonSortC
|
||
{
|
||
MonthReportId = MonthReportId,
|
||
UnitId = this.gvPersonSort.Rows[i].DataKeys[1].ToString(),
|
||
SumPersonNum = Funs.GetNewIntOrZero(values.Value<string>("SumPersonNum").ToString()),
|
||
SumOutPersonNum = Funs.GetNewIntOrZero(values.Value<string>("SumOutPersonNum").ToString()),
|
||
HSEPersonNum = Funs.GetNewIntOrZero(values.Value<string>("HSEPersonNum").ToString()),
|
||
ContractRange = values.Value<string>("ContractRange").ToString(),
|
||
Remark = values.Value<string>("Remark").ToString()
|
||
};
|
||
PersonSortCService.AddPersonSort(personSort);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 4.1保存培训
|
||
private void OperateTrainSort()
|
||
{
|
||
BLL.TrainSortCService.DeleteTrainSortsByMonthReportId(MonthReportId);
|
||
jerqueSaveTrainList();
|
||
foreach (Model.Manager_TrainSortC trainSort in trainSorts)
|
||
{
|
||
trainSort.MonthReportId = MonthReportId;
|
||
BLL.TrainSortCService.AddTrainSort(trainSort);
|
||
}
|
||
}
|
||
|
||
private void jerqueSaveTrainList()
|
||
{
|
||
trainSorts.Clear();
|
||
JArray mergedData = gvTrainSort.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
string status = mergedRow.Value<string>("status");
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
int i = mergedRow.Value<int>("index");
|
||
Model.Manager_TrainSortC trainSort = new Model.Manager_TrainSortC
|
||
{
|
||
TrainSortId = this.gvTrainSort.Rows[i].DataKeys[0].ToString(),
|
||
SortIndex = i,
|
||
TrainType = values.Value<string>("TrainType").ToString(),
|
||
//TrainContent = values.Value<string>("TrainContent").ToString(),
|
||
TeachHour = Funs.GetNewDecimalOrZero(values.Value<string>("TeachHour").ToString()),
|
||
//TeachMan = values.Value<string>("TeachMan").ToString(),
|
||
PersonNum = Funs.GetNewIntOrZero(values.Value<string>("PersonNum").ToString()),
|
||
TotalPersonNum = Funs.GetNewIntOrZero(values.Value<string>("TotalPersonNum").ToString())
|
||
};
|
||
trainSorts.Add(trainSort);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 4.2保存现场HSE会议及检查
|
||
private void OperateCheckSort()
|
||
{
|
||
BLL.CheckSortCService.DeleteCheckSortsByMonthReportId(MonthReportId);
|
||
jerqueSaveCheckList();
|
||
foreach (Model.Manager_CheckSortC checkSort in checkSorts)
|
||
{
|
||
checkSort.MonthReportId = MonthReportId;
|
||
BLL.CheckSortCService.AddCheckSort(checkSort);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 检查并保存HSE检查集合
|
||
/// </summary>
|
||
private void jerqueSaveCheckList()
|
||
{
|
||
checkSorts.Clear();
|
||
JArray mergedData = gvCheckSort.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
string status = mergedRow.Value<string>("status");
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
int i = mergedRow.Value<int>("index");
|
||
Model.Manager_CheckSortC checkSort = new Model.Manager_CheckSortC
|
||
{
|
||
CheckSortId = this.gvCheckSort.Rows[i].DataKeys[0].ToString(),
|
||
SortIndex = i,
|
||
CheckType = values.Value<string>("CheckType").ToString(),
|
||
CheckNumber = Funs.GetNewInt(values.Value<string>("CheckNumber").ToString()),
|
||
YearCheckNum = Funs.GetNewInt(values.Value<string>("YearCheckNum").ToString()),
|
||
TotalCheckNum = Funs.GetNewInt(values.Value<string>("TotalCheckNum").ToString())
|
||
};
|
||
checkSorts.Add(checkSort);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 4.6.1 应急预案发布情况
|
||
private void OperateEmergencyPlan()
|
||
{
|
||
PersonSortCService.DeleteManager_EmergencyPlan(MonthReportId);
|
||
SaveEmergencyPlanList();
|
||
foreach (Manager_EmergencyPlan item in emergencyPlanList)
|
||
{
|
||
item.MonthReportId = MonthReportId;
|
||
MonthReportCService.AddManager_EmergencyPlan(item);
|
||
}
|
||
}
|
||
|
||
private void SaveEmergencyPlanList()
|
||
{
|
||
emergencyPlanList.Clear();
|
||
JArray mergedData = EmergencyPlanGrid.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
int i = mergedRow.Value<int>("index");
|
||
Manager_EmergencyPlan checkSort = new Manager_EmergencyPlan
|
||
{
|
||
Id = this.EmergencyPlanGrid.Rows[i].DataKeys[0].ToString(),
|
||
CaType = values.Value<string>("CaType").ToString(),
|
||
MonthCount = Funs.GetNewInt(values.Value<string>("MonthCount").ToString()),
|
||
YearCount = Funs.GetNewInt(values.Value<string>("YearCount").ToString()),
|
||
ProCount = Funs.GetNewInt(values.Value<string>("ProCount").ToString()),
|
||
SortIndex = i,
|
||
};
|
||
emergencyPlanList.Add(checkSort);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 4.6.2应急演练工作情况说明
|
||
private void OperateDrillRecordList()
|
||
{
|
||
PersonSortCService.DeleteManager_DrillRecordList(MonthReportId);
|
||
SaveDrillRecordList();
|
||
foreach (Manager_DrillRecordList item in drillRecordList)
|
||
{
|
||
item.MonthReportId = MonthReportId;
|
||
MonthReportCService.AddManager_DrillRecordList(item);
|
||
}
|
||
}
|
||
|
||
private void SaveDrillRecordList()
|
||
{
|
||
drillRecordList.Clear();
|
||
JArray mergedData = DrillRecordListGrid.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
int i = mergedRow.Value<int>("index");
|
||
Manager_DrillRecordList checkSort = new Manager_DrillRecordList
|
||
{
|
||
Id = this.DrillRecordListGrid.Rows[i].DataKeys[0].ToString(),
|
||
Dname = values.Value<string>("Dname").ToString(),
|
||
Ddate = Convert.ToDateTime(values.Value<string>("Ddate").ToString()),
|
||
DrillRecordTypeName = values.Value<string>("DrillRecordTypeName").ToString(),
|
||
PersonNum = Funs.GetNewInt(values.Value<string>("PersonNum").ToString()),
|
||
DrillCost = Convert.ToDecimal(values.Value<string>("DrillCost").ToString()),
|
||
SortIndex = i,
|
||
};
|
||
drillRecordList.Add(checkSort);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 4.3隐患整改
|
||
private void OperateManager_HiddenDanger()
|
||
{
|
||
PersonSortCService.DeleteManager_HiddenDanger(MonthReportId);
|
||
JArray mergedData = GridHiddenDanger.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
string status = mergedRow.Value<string>("status");
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
int i = mergedRow.Value<int>("index");
|
||
Model.Manager_HiddenDanger model = new Model.Manager_HiddenDanger
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
MonthReportId = MonthReportId,
|
||
UnitId = this.GridHiddenDanger.Rows[i].DataKeys[1].ToString(),
|
||
CommonlyNum = Funs.GetNewIntOrZero(values.Value<string>("CommonlyNum").ToString()),
|
||
MajorNum = Funs.GetNewIntOrZero(values.Value<string>("MajorNum").ToString()),
|
||
ReRate = values.Value<string>("ReRate").ToString(),
|
||
SortIndex = i + 1,
|
||
};
|
||
db.Manager_HiddenDanger.InsertOnSubmit(model);
|
||
db.SubmitChanges();
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 4.4本月项目作业许可管理数据
|
||
private void OperateProjectAssignment()
|
||
{
|
||
//删除
|
||
PersonSortCService.DeleteManager_ProjectAssignment(MonthReportId);
|
||
var model = new Manager_ProjectAssignment()
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
MonthReportId = MonthReportId,
|
||
FireWorkCount = Funs.GetNewIntOrZero(nbFireWorkCount.Text),
|
||
BreakGroundCount = Funs.GetNewIntOrZero(nbBreakGroundCount.Text),
|
||
LimitedSpaceCount = Funs.GetNewIntOrZero(nbLimitedSpaceCount.Text),
|
||
ElectricityCount = Funs.GetNewIntOrZero(nbElectricityCount.Text),
|
||
HeightWorkCount = Funs.GetNewIntOrZero(nbHeightWorkCount.Text),
|
||
RadialWork = Funs.GetNewIntOrZero(nbRadialWork.Text),
|
||
LiftingWorkCount = Funs.GetNewIntOrZero(nbLiftingWorkCount.Text),
|
||
NightWork = Funs.GetNewIntOrZero(nbNightWork.Text),
|
||
MonthCount = Funs.GetNewIntOrZero(nbMonthCount.Text),
|
||
YearCount = Funs.GetNewIntOrZero(nbYearCount.Text),
|
||
ProCount = Funs.GetNewIntOrZero(nbProCount.Text),
|
||
};
|
||
db.Manager_ProjectAssignment.InsertOnSubmit(model);
|
||
db.SubmitChanges();
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 4.7保存奖励惩罚
|
||
private void OperateRewardAndPunishSort()
|
||
{
|
||
BLL.RewardAndPunishSortCService.DeleteRewardAndPunishSortCByMonthReportId(MonthReportId);
|
||
jerqueSavePunishList();
|
||
foreach (Model.Manager_RewardAndPunishSortC rewardAndPunishSortC in rewardAndPunishSortCs)
|
||
{
|
||
rewardAndPunishSortC.MonthReportId = MonthReportId;
|
||
BLL.RewardAndPunishSortCService.AddRewardAndPunishSortC(rewardAndPunishSortC);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 4.8保存HSE现场其他管理情况
|
||
/// <summary>
|
||
/// HSE现场其他管理情况
|
||
/// </summary>
|
||
/// <param name="monthReportId"></param>
|
||
private void OperateOtherManagementSort()
|
||
{
|
||
BLL.OtherManagementCService.DeleteOtherManagementByMonthReportId(MonthReportId);
|
||
jerqueSaveOtherManagementList();
|
||
foreach (Model.Manager_Month_OtherManagementC otherManagement in otherManagements)
|
||
{
|
||
otherManagement.MonthReportId = MonthReportId;
|
||
BLL.OtherManagementCService.AddOtherManagement(otherManagement);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 5.1保存
|
||
private void OperateFiveExpenseSort()
|
||
{
|
||
BLL.FiveExpenseCService.DeleteFiveExpenseByMonthReportId(MonthReportId);
|
||
jerqueSaveFiveExpenseList();
|
||
foreach (Model.Manager_Month_FiveExpenseC fiveExpendse in fiveExpenses)
|
||
{
|
||
fiveExpendse.MonthReportId = MonthReportId;
|
||
BLL.FiveExpenseCService.AddFiveExpense(fiveExpendse);
|
||
}
|
||
}
|
||
|
||
private void jerqueSaveFiveExpenseList()
|
||
{
|
||
fiveExpenses.Clear();
|
||
JArray mergedData = gvFiveExpenseC.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
string status = mergedRow.Value<string>("status");
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
int i = mergedRow.Value<int>("index");
|
||
Model.Manager_Month_FiveExpenseC trainSort = new Model.Manager_Month_FiveExpenseC
|
||
{
|
||
FiveExpenseId = this.gvFiveExpenseC.Rows[i].DataKeys[0].ToString(),
|
||
SortIndex = i,
|
||
InvestmentProject = values.Value<string>("InvestmentProject").ToString(),
|
||
PlanCostMonth = Funs.GetNewDecimal(values.Value<string>("PlanCostMonth").ToString()),
|
||
PlanCostYear = Funs.GetNewDecimal(values.Value<string>("PlanCostYear").ToString()),
|
||
ActualCostMonth = Funs.GetNewDecimal(values.Value<string>("ActualCostMonth").ToString()),
|
||
ActualCostYear = Funs.GetNewDecimal(values.Value<string>("ActualCostYear").ToString())
|
||
};
|
||
fiveExpenses.Add(trainSort);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 6.1未遂事件统计
|
||
private void OperateAttempted()
|
||
{
|
||
PersonSortCService.DeleteManager_Attempted(MonthReportId);
|
||
var model = new Manager_Attempted()
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
MonthReportId = MonthReportId,
|
||
WhMonthNum = Convert.ToInt32(nbWhMonthNum.Text),
|
||
WhYearNum = Convert.ToInt32(nbWhYearNum.Text),
|
||
FbsMonthNum = Convert.ToInt32(nbFbsMonthNum.Text),
|
||
FbsYearNum = Convert.ToInt32(nbFbsYearNum.Text),
|
||
ProNum = Convert.ToInt32(nbProNum.Text),
|
||
};
|
||
db.Manager_Attempted.InsertOnSubmit(model);
|
||
db.SubmitChanges();
|
||
}
|
||
#endregion
|
||
|
||
#region 6.1 2本月伤害事故统计
|
||
private void OperateInjuryAccidentSort()
|
||
{
|
||
BLL.InjuryAccidentCService.DeleteInjuryAccidengtByMonthReportId(MonthReportId);
|
||
jerqueSaveInjuryAccidentCList();
|
||
foreach (Model.Manager_Month_InjuryAccidentC injury in injuryAccidents)
|
||
{
|
||
injury.MonthReportId = MonthReportId;
|
||
BLL.InjuryAccidentCService.AddInjuryAccidentC(injury);
|
||
}
|
||
}
|
||
|
||
private void jerqueSaveInjuryAccidentCList()
|
||
{
|
||
injuryAccidents.Clear();
|
||
JArray mergedData = gvInjuryAccident.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
string status = mergedRow.Value<string>("status");
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
int i = mergedRow.Value<int>("index");
|
||
Model.Manager_Month_InjuryAccidentC monthPlanSort = new Model.Manager_Month_InjuryAccidentC
|
||
{
|
||
InjuryAccidentId = this.gvInjuryAccident.Rows[i].DataKeys[0].ToString(),
|
||
UnitName = values.Value<string>("UnitName").ToString(),
|
||
FirstAidDressing = Funs.GetNewInt(values.Value<string>("FirstAidDressing").ToString()),
|
||
MedicalTreatment = Funs.GetNewInt(values.Value<string>("MedicalTreatment").ToString()),
|
||
WorkLimitation = Funs.GetNewInt(values.Value<string>("WorkLimitation").ToString()),
|
||
LossCount = Funs.GetNewInt(values.Value<string>("LossCount").ToString()),
|
||
LossPerson = Funs.GetNewInt(values.Value<string>("LossPerson").ToString()),
|
||
LossWorkTime = Funs.GetNewDecimal(values.Value<string>("LossWorkTime").ToString()),
|
||
LossEconomy = Funs.GetNewDecimal(values.Value<string>("LossEconomy").ToString()),
|
||
DeathPerson = Funs.GetNewInt(values.Value<string>("DeathPerson").ToString()),
|
||
DeathCount = Funs.GetNewInt(values.Value<string>("DeathCount").ToString()),
|
||
DeathWorkTime = Funs.GetNewDecimal(values.Value<string>("DeathWorkTime").ToString()),
|
||
DeathEconomy = Funs.GetNewDecimal(values.Value<string>("DeathEconomy").ToString()),
|
||
};
|
||
injuryAccidents.Add(monthPlanSort);
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 7.1保存下个月计划
|
||
/// <summary>
|
||
/// 7.2 其他HSE工作计划
|
||
/// </summary>
|
||
/// <param name="monthReportId"></param>
|
||
private void OperateOtherWorkPlanCSort()
|
||
{
|
||
BLL.OtherWorkPlanCService.DeleteOtherWorkPlanByMonthReportId(MonthReportId);
|
||
jerqueSaveOtherWorkPlanCList();
|
||
foreach (Model.Manager_Month_OtherWorkPlanC item in otherWorkPlanCs)
|
||
{
|
||
item.MonthReportId = MonthReportId;
|
||
BLL.OtherWorkPlanCService.AddOtherWorkPlan(item);
|
||
}
|
||
}
|
||
|
||
private void jerqueSaveOtherWorkPlanCList()
|
||
{
|
||
otherWorkPlanCs.Clear();
|
||
JArray mergedData = gvOtherWorkPlanC.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
string status = mergedRow.Value<string>("status");
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
int i = mergedRow.Value<int>("index");
|
||
Model.Manager_Month_OtherWorkPlanC otherWorkPlanC = new Model.Manager_Month_OtherWorkPlanC
|
||
{
|
||
OtherWorkPlanId = this.gvOtherWorkPlanC.Rows[i].DataKeys[0].ToString(),
|
||
SortIndex = i,
|
||
WorkContent = values.Value<string>("WorkContent").ToString()
|
||
};
|
||
otherWorkPlanCs.Add(otherWorkPlanC);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 增加其他HSE工作计划
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnOtherWorkPlanC_Click(object sender, EventArgs e)
|
||
{
|
||
jerqueSaveOtherWorkPlanCList();
|
||
Model.Manager_Month_OtherWorkPlanC otherWorkPlanC = new Model.Manager_Month_OtherWorkPlanC
|
||
{
|
||
OtherWorkPlanId = SQLHelper.GetNewID(typeof(Model.Manager_Month_OtherWorkPlanC))
|
||
};
|
||
otherWorkPlanCs.Add(otherWorkPlanC);
|
||
this.gvOtherWorkPlanC.DataSource = otherWorkPlanCs;
|
||
this.gvOtherWorkPlanC.DataBind();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除其他HSE工作计划
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void gvOtherWorkPlanC_RowCommand(object sender, GridCommandEventArgs e)
|
||
{
|
||
jerqueSaveOtherWorkPlanCList();
|
||
string rowID = this.gvOtherWorkPlanC.DataKeys[e.RowIndex][0].ToString();
|
||
if (e.CommandName == "Delete")
|
||
{
|
||
foreach (var item in otherWorkPlanCs)
|
||
{
|
||
if (item.OtherWorkPlanId == rowID)
|
||
{
|
||
otherWorkPlanCs.Remove(item);
|
||
break;
|
||
}
|
||
}
|
||
gvOtherWorkPlanC.DataSource = otherWorkPlanCs;
|
||
gvOtherWorkPlanC.DataBind();
|
||
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 8. 保存HSE合规义务识别与评价
|
||
/// <summary>
|
||
/// 保存HSE合规义务识别与评价
|
||
/// </summary>
|
||
/// <param name="monthReportId"></param>
|
||
private void OperateComplianceObligationsCSort()
|
||
{
|
||
BLL.ComplianceObligationsCService.DeleteComplianceObligationsCByMonthReportId(MonthReportId);
|
||
jerqueSaveComplianceObligationsCList();
|
||
foreach (Model.Manager_Month_ComplianceObligationsC coc in complianceObligationsCs)
|
||
{
|
||
coc.MonthReportId = MonthReportId;
|
||
BLL.ComplianceObligationsCService.AddComplianceObligationsC(coc);
|
||
}
|
||
}
|
||
|
||
///// <summary>
|
||
///// 增加HSE合规义务识别与评价
|
||
///// </summary>
|
||
///// <param name="sender"></param>
|
||
///// <param name="e"></param>
|
||
protected void btnNew_Click(object sender, EventArgs e)
|
||
{
|
||
jerqueSaveComplianceObligationsCList();
|
||
Model.Manager_Month_ComplianceObligationsC complianceObligationsC = new Model.Manager_Month_ComplianceObligationsC
|
||
{
|
||
ComplianceObligationsId = SQLHelper.GetNewID(typeof(Model.Manager_Month_ComplianceObligationsC))
|
||
};
|
||
complianceObligationsCs.Add(complianceObligationsC);
|
||
this.gvOperateComplianceObligations.DataSource = complianceObligationsCs;
|
||
this.gvOperateComplianceObligations.DataBind();
|
||
}
|
||
|
||
///// <summary>
|
||
///// 检查并保存危险源动态识别及控制集合
|
||
///// </summary>
|
||
private void jerqueSaveComplianceObligationsCList()
|
||
{
|
||
complianceObligationsCs.Clear();
|
||
JArray mergedData = gvOperateComplianceObligations.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
string status = mergedRow.Value<string>("status");
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
int i = mergedRow.Value<int>("index");
|
||
Model.Manager_Month_ComplianceObligationsC hazardSort = new Model.Manager_Month_ComplianceObligationsC
|
||
{
|
||
ComplianceObligationsId = this.gvOperateComplianceObligations.Rows[i].DataKeys[0].ToString(),
|
||
InformationContent = values.Value<string>("InformationContent").ToString(),
|
||
ResponseMeasures = values.Value<string>("ResponseMeasures").ToString(),
|
||
ImplementationStatus = values.Value<string>("ImplementationStatus").ToString(),
|
||
EvaluationConclusion = values.Value<string>("EvaluationConclusion").ToString()
|
||
};
|
||
complianceObligationsCs.Add(hazardSort);
|
||
}
|
||
}
|
||
|
||
protected void gvOperateComplianceObligations_RowCommand(object sender, GridCommandEventArgs e)
|
||
{
|
||
jerqueSaveComplianceObligationsCList();
|
||
string rowID = this.gvOperateComplianceObligations.DataKeys[e.RowIndex][0].ToString();
|
||
if (e.CommandName == "Delete")
|
||
{
|
||
foreach (var item in complianceObligationsCs)
|
||
{
|
||
if (item.ComplianceObligationsId == rowID)
|
||
{
|
||
complianceObligationsCs.Remove(item);
|
||
break;
|
||
}
|
||
}
|
||
gvOperateComplianceObligations.DataSource = complianceObligationsCs;
|
||
gvOperateComplianceObligations.DataBind();
|
||
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 选择照片事件
|
||
protected void filePhoto_FileSelected1(object sender, EventArgs e)
|
||
{
|
||
if (filePhoto.HasFile)
|
||
{
|
||
string fileName = filePhoto.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto.SaveAs(Server.MapPath("~/upload/" + fileName));
|
||
|
||
imgPhoto.ImageUrl = "~/upload/" + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto.Reset();
|
||
}
|
||
}
|
||
|
||
protected void filePhoto_FileSelected2(object sender, EventArgs e)
|
||
{
|
||
if (filePhoto2.HasFile)
|
||
{
|
||
string fileName = filePhoto2.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto2.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto2.SaveAs(Server.MapPath("~/upload/" + fileName));
|
||
|
||
imgPhoto2.ImageUrl = "~/upload/" + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto2.Reset();
|
||
}
|
||
}
|
||
|
||
protected void filePhoto_FileSelected3(object sender, EventArgs e)
|
||
{
|
||
if (filePhoto3.HasFile)
|
||
{
|
||
string fileName = filePhoto3.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto3.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto3.SaveAs(Server.MapPath("~/upload/" + fileName));
|
||
|
||
imgPhoto3.ImageUrl = "~/upload/" + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto3.Reset();
|
||
}
|
||
}
|
||
|
||
protected void filePhoto_FileSelected4(object sender, EventArgs e)
|
||
{
|
||
if (filePhoto4.HasFile)
|
||
{
|
||
string fileName = filePhoto4.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto4.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto4.SaveAs(Server.MapPath("~/upload/" + fileName));
|
||
|
||
imgPhoto4.ImageUrl = "~/upload/" + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto4.Reset();
|
||
}
|
||
}
|
||
|
||
protected void filePhoto_FileSelected5(object sender, EventArgs e)
|
||
{
|
||
if (filePhoto5.HasFile)
|
||
{
|
||
string fileName = filePhoto5.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto5.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto5.SaveAs(Server.MapPath("~/upload/" + fileName));
|
||
|
||
imgPhoto5.ImageUrl = "~/upload/" + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto5.Reset();
|
||
}
|
||
}
|
||
|
||
protected void filePhoto_FileSelected6(object sender, EventArgs e)
|
||
{
|
||
if (filePhoto6.HasFile)
|
||
{
|
||
string fileName = filePhoto6.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto6.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto6.SaveAs(Server.MapPath("~/upload/" + fileName));
|
||
|
||
imgPhoto6.ImageUrl = "~/upload/" + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto6.Reset();
|
||
}
|
||
}
|
||
|
||
protected void filePhoto_FileSelected7(object sender, EventArgs e)
|
||
{
|
||
if (filePhoto7.HasFile)
|
||
{
|
||
string fileName = filePhoto7.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto7.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto7.SaveAs(Server.MapPath("~/upload/" + fileName));
|
||
|
||
imgPhoto7.ImageUrl = "~/upload/" + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto7.Reset();
|
||
}
|
||
}
|
||
|
||
protected void filePhoto_FileSelected8(object sender, EventArgs e)
|
||
{
|
||
if (filePhoto8.HasFile)
|
||
{
|
||
string fileName = filePhoto8.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto8.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto8.SaveAs(Server.MapPath("~/upload/" + fileName));
|
||
|
||
imgPhoto8.ImageUrl = "~/upload/" + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto8.Reset();
|
||
}
|
||
}
|
||
|
||
protected void filePhoto_FileSelected9(object sender, EventArgs e)
|
||
{
|
||
if (filePhoto9.HasFile)
|
||
{
|
||
string fileName = filePhoto9.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto9.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto9.SaveAs(Server.MapPath("~/upload/" + fileName));
|
||
|
||
imgPhoto9.ImageUrl = "~/upload/" + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto9.Reset();
|
||
}
|
||
}
|
||
|
||
protected void filePhoto_FileSelected10(object sender, EventArgs e)
|
||
{
|
||
if (filePhoto10.HasFile)
|
||
{
|
||
string fileName = filePhoto10.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto10.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto10.SaveAs(Server.MapPath("~/upload/" + fileName));
|
||
|
||
imgPhoto10.ImageUrl = "~/upload/" + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto10.Reset();
|
||
}
|
||
}
|
||
|
||
protected void filePhoto_FileSelected11(object sender, EventArgs e)
|
||
{
|
||
if (filePhoto11.HasFile)
|
||
{
|
||
string fileName = filePhoto11.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto11.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto11.SaveAs(Server.MapPath("~/upload/" + fileName));
|
||
|
||
imgPhoto11.ImageUrl = "~/upload/" + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto11.Reset();
|
||
}
|
||
}
|
||
|
||
protected void filePhoto_FileSelected12(object sender, EventArgs e)
|
||
{
|
||
if (filePhoto12.HasFile)
|
||
{
|
||
string fileName = filePhoto12.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto12.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto12.SaveAs(Server.MapPath("~/upload/" + fileName));
|
||
|
||
imgPhoto12.ImageUrl = "~/upload/" + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto12.Reset();
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 保存图片
|
||
private void SaveImages() {
|
||
TextBoxContentService.Delete(MonthReportId);
|
||
|
||
var ImageLists = new List<Model.Report_TextBoxContent>();
|
||
var imgage1 = new Model.Report_TextBoxContent();
|
||
imgage1.Id = Guid.NewGuid().ToString();
|
||
imgage1.ReportId = MonthReportId;
|
||
imgage1.ContentType = "10-1";
|
||
imgage1.ContentText = txtPhotoContent1.Text;
|
||
imgage1.ImageUrl = imgPhoto.ImageUrl.Substring(imgPhoto.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage1);
|
||
|
||
var imgage2 = new Model.Report_TextBoxContent();
|
||
imgage2.Id = Guid.NewGuid().ToString();
|
||
imgage2.ReportId = MonthReportId;
|
||
imgage2.ContentType = "10-2";
|
||
imgage2.ContentText = txtPhotoContent2.Text;
|
||
imgage2.ImageUrl = imgPhoto2.ImageUrl.Substring(imgPhoto2.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage2);
|
||
|
||
var imgage3 = new Model.Report_TextBoxContent();
|
||
imgage3.Id = Guid.NewGuid().ToString();
|
||
imgage3.ReportId = MonthReportId;
|
||
imgage3.ContentType = "10-3";
|
||
imgage3.ContentText = txtPhotoContent3.Text;
|
||
imgage3.ImageUrl = imgPhoto3.ImageUrl.Substring(imgPhoto3.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage3);
|
||
|
||
var imgage4 = new Model.Report_TextBoxContent();
|
||
imgage4.Id = Guid.NewGuid().ToString();
|
||
imgage4.ReportId = MonthReportId;
|
||
imgage4.ContentType = "10-4";
|
||
imgage4.ContentText = txtPhotoContent4.Text;
|
||
imgage4.ImageUrl = imgPhoto4.ImageUrl.Substring(imgPhoto4.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage4);
|
||
|
||
var imgage5 = new Model.Report_TextBoxContent();
|
||
imgage5.Id = Guid.NewGuid().ToString();
|
||
imgage5.ReportId = MonthReportId;
|
||
imgage5.ContentType = "10-5";
|
||
imgage5.ContentText = txtPhotoContent5.Text;
|
||
imgage5.ImageUrl = imgPhoto5.ImageUrl.Substring(imgPhoto5.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage5);
|
||
|
||
var imgage6 = new Model.Report_TextBoxContent();
|
||
imgage6.Id = Guid.NewGuid().ToString();
|
||
imgage6.ReportId = MonthReportId;
|
||
imgage6.ContentType = "10-7";
|
||
imgage6.ContentText = txtPhotoContent7.Text;
|
||
imgage6.ImageUrl = imgPhoto7.ImageUrl.Substring(imgPhoto6.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage6);
|
||
|
||
imgage6 = new Model.Report_TextBoxContent();
|
||
imgage6.Id = Guid.NewGuid().ToString();
|
||
imgage6.ReportId = MonthReportId;
|
||
imgage6.ContentType = "10-6";
|
||
imgage6.ContentText = txtPhotoContent6.Text;
|
||
imgage6.ImageUrl = imgPhoto6.ImageUrl.Substring(imgPhoto6.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage6);
|
||
|
||
//
|
||
imgage6 = new Model.Report_TextBoxContent();
|
||
imgage6.Id = Guid.NewGuid().ToString();
|
||
imgage6.ReportId = MonthReportId;
|
||
imgage6.ContentType = "10-8";
|
||
imgage6.ContentText = txtPhotoContent8.Text;
|
||
imgage6.ImageUrl = imgPhoto8.ImageUrl.Substring(imgPhoto6.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage6);
|
||
|
||
imgage6 = new Model.Report_TextBoxContent();
|
||
imgage6.Id = Guid.NewGuid().ToString();
|
||
imgage6.ReportId = MonthReportId;
|
||
imgage6.ContentType = "10-9";
|
||
imgage6.ContentText = txtPhotoContent9.Text;
|
||
imgage6.ImageUrl = imgPhoto9.ImageUrl.Substring(imgPhoto6.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage6);
|
||
|
||
imgage6 = new Model.Report_TextBoxContent();
|
||
imgage6.Id = Guid.NewGuid().ToString();
|
||
imgage6.ReportId = MonthReportId;
|
||
imgage6.ContentType = "10-10";
|
||
imgage6.ContentText = txtPhotoContent10.Text;
|
||
imgage6.ImageUrl = imgPhoto10.ImageUrl.Substring(imgPhoto6.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage6);
|
||
|
||
imgage6 = new Model.Report_TextBoxContent();
|
||
imgage6.Id = Guid.NewGuid().ToString();
|
||
imgage6.ReportId = MonthReportId;
|
||
imgage6.ContentType = "10-11";
|
||
imgage6.ContentText = txtPhotoContent11.Text;
|
||
imgage6.ImageUrl = imgPhoto11.ImageUrl.Substring(imgPhoto6.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage6);
|
||
|
||
imgage6 = new Model.Report_TextBoxContent();
|
||
imgage6.Id = Guid.NewGuid().ToString();
|
||
imgage6.ReportId = MonthReportId;
|
||
imgage6.ContentType = "10-12";
|
||
imgage6.ContentText = txtPhotoContent12.Text;
|
||
imgage6.ImageUrl = imgPhoto12.ImageUrl.Substring(imgPhoto6.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage6);
|
||
|
||
db.Report_TextBoxContent.InsertAllOnSubmit(ImageLists);
|
||
db.SubmitChanges();
|
||
}
|
||
#endregion
|
||
#endregion
|
||
|
||
#region 加载grid
|
||
void lodAllGrid(string objType)
|
||
{
|
||
if (objType == "0")
|
||
{
|
||
//添加的时候加载
|
||
//2.本月项目现场HSE人力投入情况
|
||
GetPersonSort();
|
||
//3.本月项目现场HSE人工日统计
|
||
getMonthReportCHSEDay();
|
||
//4.1培训
|
||
GetTrainSort();
|
||
//4.2现场HSE绩效数据统计
|
||
GetCheckSort();
|
||
//4.3本月隐患
|
||
GetManager_HiddenDanger();
|
||
|
||
//4.4本月项目作业许可管理数据
|
||
getProjectAssignment();
|
||
|
||
//4.5项目本月危大工程管理数据
|
||
getMonthHazardousGrid();
|
||
|
||
//4.6.1 应急预案发布情况
|
||
GetEmergencyPlan();
|
||
|
||
//4.6.2 应急演练工作情况说明
|
||
GetDrillRecordList();
|
||
|
||
//4.7HSE奖励与处罚
|
||
GetRewardAndPunishSort();
|
||
|
||
//5.1本月项目HSE费用投入统计
|
||
GetFiveExpenseList();
|
||
|
||
//6.1未遂事件统计
|
||
GetAttempted();
|
||
|
||
//6.1 2本月伤害事故统计
|
||
GetInjuryAccident();
|
||
|
||
//6.3 HSE目标实现情况
|
||
GetGalachList();
|
||
|
||
}
|
||
else
|
||
{
|
||
//2.本月项目现场HSE人力投入情况
|
||
GetPersonSortEdit();
|
||
|
||
//3.本月隐患
|
||
GetManager_HiddenDangerEdit();
|
||
|
||
#region 加载照片
|
||
var txtReportList = db.Report_TextBoxContent.Where(x => x.ReportId == MonthReportId).ToList();
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "10-1") != null)
|
||
{
|
||
imgPhoto.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "10-1").ImageUrl;
|
||
txtPhotoContent1.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-1").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "10-2") != null)
|
||
{
|
||
imgPhoto2.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "10-2").ImageUrl;
|
||
txtPhotoContent2.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-2").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "10-3") != null)
|
||
{
|
||
imgPhoto3.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "10-3").ImageUrl;
|
||
txtPhotoContent3.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-3").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "10-4") != null)
|
||
{
|
||
imgPhoto4.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "10-4").ImageUrl;
|
||
txtPhotoContent4.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-4").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "10-5") != null)
|
||
{
|
||
imgPhoto5.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "10-5").ImageUrl;
|
||
txtPhotoContent5.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-5").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "10-6") != null)
|
||
{
|
||
imgPhoto6.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "10-6").ImageUrl;
|
||
txtPhotoContent6.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-6").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "10-7") != null)
|
||
{
|
||
imgPhoto7.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "10-7").ImageUrl;
|
||
txtPhotoContent7.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-7").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "10-8") != null)
|
||
{
|
||
imgPhoto8.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "10-8").ImageUrl;
|
||
txtPhotoContent8.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-8").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "10-9") != null)
|
||
{
|
||
imgPhoto9.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "10-9").ImageUrl;
|
||
txtPhotoContent9.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-9").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "10-10") != null)
|
||
{
|
||
imgPhoto10.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "10-10").ImageUrl;
|
||
txtPhotoContent10.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-10").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "10-11") != null)
|
||
{
|
||
imgPhoto11.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "10-11").ImageUrl;
|
||
txtPhotoContent11.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-11").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "10-12") != null)
|
||
{
|
||
imgPhoto12.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "10-12").ImageUrl;
|
||
txtPhotoContent12.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-12").ContentText;
|
||
}
|
||
#endregion
|
||
|
||
}
|
||
|
||
}
|
||
|
||
#region 2 人力投入情况
|
||
/// <summary>
|
||
/// 显示月报告人员投入情况
|
||
/// </summary>
|
||
private void GetPersonSort()
|
||
{
|
||
List<Model.Manager_PersonSortC> personSorts = new List<Model.Manager_PersonSortC>();
|
||
//var units = from x in Funs.DB.Project_ProjectUnit
|
||
// where x.ProjectId == this.ProjectId && (x.UnitType == "1" || x.UnitType == "2")
|
||
// orderby x.UnitType
|
||
// select x; //1为总包,2为施工分包
|
||
int totalSumPersonNum = 0;//总部
|
||
int totalSumOutPersonNum = 0;//外聘
|
||
int totalHSEPersonNum = 0;
|
||
var spckList = db.SitePerson_Checking.Where(x => x.IntoOutTime >= startTime
|
||
&& x.IntoOutTime <= endTime && x.ProjectId == ProjectId && x.IntoOut == "1");
|
||
if (units.Count() > 0)
|
||
{
|
||
foreach (Model.Project_ProjectUnit u in units)
|
||
{
|
||
Model.Manager_PersonSortC personSort = new Model.Manager_PersonSortC
|
||
{
|
||
PersonSortId = Guid.NewGuid().ToString(),
|
||
UnitId = u.UnitId,
|
||
HSEPersonNum = 0,
|
||
ContractRange = u.ContractRange
|
||
};
|
||
//本部本月人数,本年考勤人数除当前月份,取平均数
|
||
//年度
|
||
var yearList = spckList.Where(x => x.UnitId == u.UnitId).ToList().Select(x => new hseDayItem()
|
||
{
|
||
IdentityCard = x.IdentityCard,
|
||
IntoOutTime = getShortTime(x.IntoOutTime)
|
||
}).GroupBy(x => new { x.IdentityCard})
|
||
.ToList();
|
||
|
||
personSort.SumPersonNum = yearList.Count();
|
||
|
||
//五环
|
||
if (u.UnitId == Const.UnitId_CWCEC)
|
||
{
|
||
personSort.SumOutPersonNum = 0;
|
||
}
|
||
else {
|
||
personSort.SumOutPersonNum = 0;
|
||
}
|
||
////本部人员
|
||
//SumPersonNum = BLL.PersonService.GetPersonCountByUnitId(u.UnitId, ProjectId, Convert.ToDateTime(txtEndDate.Text), false),//本部
|
||
// SumOutPersonNum = 0,//外聘
|
||
personSorts.Add(personSort);
|
||
totalSumPersonNum += Convert.ToInt32(personSort.SumPersonNum)+ Convert.ToInt32(personSort.SumOutPersonNum);
|
||
totalSumOutPersonNum += Convert.ToInt32(personSort.SumOutPersonNum);
|
||
totalHSEPersonNum += Convert.ToInt32(personSort.HSEPersonNum);
|
||
}
|
||
}
|
||
this.gvPersonSort.DataSource = personSorts;
|
||
this.gvPersonSort.DataBind();
|
||
if (this.gvPersonSort.Rows.Count > 0)
|
||
{
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitId", "合计:");
|
||
summary.Add("SumPersonNum", totalSumPersonNum);
|
||
//summary.Add("SumOutPersonNum", totalSumOutPersonNum);
|
||
summary.Add("HSEPersonNum", totalHSEPersonNum);
|
||
this.gvPersonSort.SummaryData = summary;
|
||
}
|
||
else
|
||
{
|
||
this.gvPersonSort.SummaryData = null;
|
||
}
|
||
}
|
||
|
||
//修改的时候
|
||
void GetPersonSortEdit()
|
||
{
|
||
var q = from x in db.Manager_PersonSortC
|
||
where x.MonthReportId == MonthReportId
|
||
select x;
|
||
if (q.Count() > 0) //保存过数据
|
||
{
|
||
//人力投入情况
|
||
List<Model.Manager_PersonSortC> sorts = (from x in db.Manager_PersonSortC
|
||
join y in db.Project_ProjectUnit
|
||
on x.UnitId equals y.UnitId
|
||
where x.MonthReportId == MonthReportId && y.ProjectId == this.ProjectId
|
||
orderby y.UnitType
|
||
select x).Distinct().ToList();
|
||
List<Model.Manager_PersonSortC> personSorts = new List<Model.Manager_PersonSortC>();
|
||
|
||
foreach (var unit in units)
|
||
{
|
||
Model.Manager_PersonSortC personSort = sorts.FirstOrDefault(x => x.UnitId == unit.UnitId);
|
||
if (personSort != null)
|
||
{
|
||
personSorts.Add(personSort);
|
||
}
|
||
}
|
||
this.gvPersonSort.DataSource = personSorts;
|
||
this.gvPersonSort.DataBind();
|
||
if (this.gvPersonSort.Rows.Count > 0)
|
||
{
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitId", "合计:");
|
||
summary.Add("SumPersonNum", (from x in personSorts select x.SumPersonNum ?? 0).Sum()+ (from x in personSorts select x.SumOutPersonNum ?? 0).Sum());
|
||
//summary.Add("SumOutPersonNum", (from x in personSorts select x.SumOutPersonNum ?? 0).Sum());
|
||
summary.Add("HSEPersonNum", (from x in personSorts select x.HSEPersonNum ?? 0).Sum());
|
||
this.gvPersonSort.SummaryData = summary;
|
||
}
|
||
else
|
||
{
|
||
this.gvPersonSort.SummaryData = null;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
GetPersonSort();
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 3.本月项目现场HSE人工日统计
|
||
public class hseDayItem {
|
||
public string IdentityCard { get; set; }
|
||
|
||
public string IntoOutTime { get; set; }
|
||
|
||
public string UnitId { get; set; }
|
||
}
|
||
|
||
public string getShortTime(DateTime? a) {
|
||
return Convert.ToDateTime(a).ToString("yyyy-MM-dd");
|
||
}
|
||
|
||
private void getMonthReportCHSEDay()
|
||
{
|
||
//数据了太大,查起来有点问题。
|
||
|
||
//var spckList = db.SitePerson_Checking.Where(x => x.ProjectId == ProjectId && x.IntoOut == "1").Select(x=>new {
|
||
// IntoOutTime=x.IntoOutTime,
|
||
// IdentityCard=x.IdentityCard,
|
||
// UnitId=x.UnitId
|
||
//});
|
||
//本月项目现场HSE人工日统计
|
||
Model.MonthReportCHSEDay hseDay = new Model.MonthReportCHSEDay
|
||
{
|
||
MonthHSEDay = (endTime - startTime).Days + 1
|
||
};
|
||
//累计安全工作天数(当前日期-项目开始日期)
|
||
hseDay.SumHSEDay = (endTime - projectStartTime).Days;
|
||
|
||
////本月HSE人工日、年度累计HSE人工日、总累计HSE人工日,考勤中取
|
||
////本月
|
||
//var list = spckList.Where(x => x.IntoOutTime >= startTime
|
||
//&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
|
||
//{
|
||
// IdentityCard = x.IdentityCard,
|
||
// IntoOutTime = getShortTime(x.IntoOutTime)
|
||
//}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||
// .ToList();
|
||
|
||
//本月HSE人工日
|
||
hseDay.MonthHSEWorkDay = SQLHelper.RunProcGetHsseKq(ProjectId, startTime, endTime, "0");
|
||
|
||
//list.Count();
|
||
//本月安全人工时(五环)
|
||
//hseDay.HseManhours = spckList.Where(x => x.IntoOutTime >= startTime
|
||
//&& x.IntoOutTime <= endTime && x.UnitId == Const.UnitId_CWCEC).ToList().Select(x => new hseDayItem()
|
||
//{
|
||
// IdentityCard = x.IdentityCard,
|
||
// IntoOutTime = getShortTime(x.IntoOutTime)
|
||
//}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||
// .ToList().Count() * 8;
|
||
hseDay.HseManhours = SQLHelper.RunProcGetHsseKq(ProjectId, startTime, endTime, "3");
|
||
//本月安全人工时(分包商)
|
||
hseDay.SubcontractManHours = SQLHelper.RunProcGetHsseKq(ProjectId, startTime, endTime, "1");
|
||
|
||
// spckList.Where(x => x.IntoOutTime >= startTime
|
||
//&& x.IntoOutTime <= endTime && x.UnitId != Const.UnitId_CWCEC).ToList().Select(x => new hseDayItem()
|
||
//{
|
||
// IdentityCard = x.IdentityCard,
|
||
// IntoOutTime = getShortTime(x.IntoOutTime)
|
||
//}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||
// .ToList().Count() * 8;
|
||
|
||
//年度
|
||
//var yearList = spckList.Where(x => x.IntoOutTime >= yearStartTime
|
||
// && x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
|
||
// {
|
||
// IdentityCard = x.IdentityCard,
|
||
// IntoOutTime = getShortTime(x.IntoOutTime)
|
||
// }).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||
// .ToList();
|
||
|
||
|
||
//年度累计人工日
|
||
hseDay.YearHSEWorkDay = SQLHelper.RunProcGetHsseKq(ProjectId, yearStartTime, endTime, "0"); ;
|
||
//yearList.Count;
|
||
//年度累计HSE人工时
|
||
hseDay.TotalHseManhoursYear = hseDay.YearHSEWorkDay*8;
|
||
//yearList.Count * 8;
|
||
|
||
// // //项目累计
|
||
// var pList = spckList.Where(x => x.IntoOutTime >= projectStartTime
|
||
//&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
|
||
//{
|
||
// IdentityCard = x.IdentityCard,
|
||
// IntoOutTime = getShortTime(x.IntoOutTime)
|
||
//}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||
// .ToList();
|
||
|
||
hseDay.SumHSEWorkDay = SQLHelper.RunProcGetHsseKq(ProjectId, projectStartTime, endTime, "0");
|
||
//pList.Count;
|
||
|
||
hseDay.TotalHseManhours = hseDay.SumHSEWorkDay*8;
|
||
//pList.Count * 8;
|
||
|
||
List<Model.MonthReportCHSEDay> listCHSEDay = new List<Model.MonthReportCHSEDay>();
|
||
listCHSEDay.Add(hseDay);
|
||
this.gvHSEDay.DataSource = listCHSEDay;
|
||
this.gvHSEDay.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region HSE培训
|
||
/// <summary>
|
||
/// 显示月报告HSE培训情况
|
||
/// </summary>
|
||
private void GetTrainSort()
|
||
{
|
||
trainSorts.Clear();
|
||
var TotalPersonNum = 0;
|
||
var list = db.Base_TrainType.ToList().OrderBy(x=>x.TrainTypeCode);
|
||
var listTrain = BLL.EduTrain_TrainRecordService.GetTrainingsByTrainDate(startTime, endTime, this.ProjectId);
|
||
var listAllTrain = BLL.EduTrain_TrainRecordService.GetTrainingsByTrainDate(endTime, this.ProjectId);
|
||
|
||
var listBosheng = db.Bo_Sheng_Train.Where(x => x.ProjectId == ProjectId && x.TrainStartDate >= startTime && x.TrainStartDate <= endTime).ToList();
|
||
var listAllBosheng = db.Bo_Sheng_Train.Where(x => x.ProjectId == ProjectId && x.TrainStartDate <= endTime).ToList();
|
||
foreach (var item in list)
|
||
{
|
||
int i = 0;
|
||
var trainSort = new Model.Manager_TrainSortC
|
||
{
|
||
TrainSortId = SQLHelper.GetNewID(typeof(Model.Manager_TrainSortC)),
|
||
SortIndex = i
|
||
};
|
||
trainSort.TrainType = item.TrainTypeName;
|
||
if (listTrain.Count > 0)
|
||
{
|
||
trainSort.TeachHour = listTrain.Where(x => x.TrainTypeId == item.TrainTypeId).Sum(x => x.TeachHour);
|
||
trainSort.PersonNum = listTrain.Where(x => x.TrainTypeId == item.TrainTypeId).Sum(x => x.TrainPersonNum);
|
||
}
|
||
else
|
||
{
|
||
trainSort.TeachHour = 0;
|
||
trainSort.PersonNum = 0;
|
||
}
|
||
|
||
if (listBosheng.Count> 0)
|
||
{
|
||
//入场
|
||
if (item.TrainTypeId == "dfb6a37e-4412-4ba9-ad59-3bc505bc21f7")
|
||
{
|
||
trainSort.PersonNum += listBosheng.Where(x => x.TrainType.Contains("入场")).Sum(x=>x.PersonCount);
|
||
Func<string, decimal, decimal> funDelegate = CustomCount;
|
||
decimal numSum = 0;
|
||
trainSort.TeachHour += listBosheng.Where(x => x.TrainType.Contains("入场")).Sum(x => funDelegate(x.TrainPeriod, numSum));
|
||
}
|
||
else if (item.TrainTypeId == "c1a513bb-a547-45b0-944d-b0dd88f06f82")
|
||
{
|
||
//其他
|
||
trainSort.PersonNum += listBosheng.Where(x => x.TrainType.Contains("其他")).Sum(x => x.PersonCount);
|
||
Func<string, decimal, decimal> funDelegate = CustomCount;
|
||
decimal numSum = 0;
|
||
trainSort.TeachHour += listBosheng.Where(x => x.TrainType.Contains("其他")).Sum(x => funDelegate(x.TrainPeriod, numSum));
|
||
}
|
||
else {
|
||
//专项
|
||
trainSort.PersonNum += listBosheng.Where(x => x.TrainType.Contains("专项")).Sum(x => x.PersonCount);
|
||
Func<string, decimal, decimal> funDelegate = CustomCount;
|
||
decimal numSum = 0;
|
||
trainSort.TeachHour += listBosheng.Where(x => x.TrainType.Contains("专项")).Sum(x => funDelegate(x.TrainPeriod, numSum));
|
||
}
|
||
}
|
||
|
||
if (listAllTrain.Count > 0)
|
||
{
|
||
trainSort.TotalPersonNum = listAllTrain.Where(x => x.TrainTypeId == item.TrainTypeId).Sum(x => x.TrainPersonNum);
|
||
TotalPersonNum += Convert.ToInt32(trainSort.TotalPersonNum);
|
||
}
|
||
else
|
||
{
|
||
trainSort.TotalPersonNum = 0;
|
||
}
|
||
if (listAllBosheng.Count>0)
|
||
{
|
||
//入场
|
||
if (item.TrainTypeId == "dfb6a37e-4412-4ba9-ad59-3bc505bc21f7")
|
||
{
|
||
trainSort.TotalPersonNum += listAllBosheng.Where(x => x.TrainType.Contains("入场")).Sum(x => x.PersonCount);
|
||
TotalPersonNum+= Convert.ToInt32(trainSort.TotalPersonNum);
|
||
}
|
||
else if (item.TrainTypeId == "c1a513bb-a547-45b0-944d-b0dd88f06f82")
|
||
{
|
||
//其他
|
||
trainSort.TotalPersonNum += listAllBosheng.Where(x => x.TrainType.Contains("其他")).Sum(x => x.PersonCount);
|
||
TotalPersonNum += Convert.ToInt32(trainSort.TotalPersonNum);
|
||
}
|
||
else
|
||
{
|
||
//专项
|
||
trainSort.TotalPersonNum += listAllBosheng.Where(x => x.TrainType.Contains("专项")).Sum(x => x.PersonCount);
|
||
TotalPersonNum += Convert.ToInt32(trainSort.TotalPersonNum);
|
||
}
|
||
}
|
||
|
||
|
||
//博晟工具箱中的数据
|
||
|
||
i++;
|
||
trainSorts.Add(trainSort);
|
||
}
|
||
this.gvTrainSort.DataSource = trainSorts;
|
||
this.gvTrainSort.DataBind();
|
||
if (this.gvTrainSort.Rows.Count > 0)
|
||
{
|
||
JObject summary = new JObject();
|
||
summary.Add("TrainType", "培训人数合计:");
|
||
summary.Add("TotalPersonNum", TotalPersonNum);
|
||
this.gvTrainSort.SummaryData = summary;
|
||
}
|
||
else
|
||
{
|
||
this.gvTrainSort.SummaryData = null;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
public static decimal CustomCount(string strNum, decimal Sum)
|
||
{
|
||
Sum += Convert.ToDecimal(strNum);
|
||
return Sum;
|
||
}
|
||
|
||
#region 4.2现场HSE会议及检查统计
|
||
private void GetCheckSort()
|
||
{
|
||
var hselogList = db.Manager_HSSELog.Where(x => x.ProjectId == ProjectId).ToList();
|
||
int i = 0;
|
||
|
||
#region HSE会议 本月开展次数
|
||
int safetyLeaderGroup = BLL.SafetyLeaderGroupMeetingService.GetCountByTime(startTime, endTime, this.ProjectId);//安全领导小组会议
|
||
int weekMeeting = BLL.WeekMeetingService.GetCountByTime(startTime, endTime, this.ProjectId);//周例会
|
||
int monthMeeting = BLL.MonthMeetingService.GetCountByTime(startTime, endTime, this.ProjectId);//月例会
|
||
int specialMeeting = BLL.SpecialMeetingService.GetCountByTime(startTime, endTime, this.ProjectId);//专题例会
|
||
int attendMeeting = BLL.AttendMeetingService.GetCountByTime(startTime, endTime, this.ProjectId);//其他会议
|
||
int classMeeting = BLL.ClassMeetingService.GetCountByTime(startTime, endTime, this.ProjectId);//班前会
|
||
#endregion
|
||
#region HSE会议 年度累计次数
|
||
int yearSafetyLeaderGroup = BLL.SafetyLeaderGroupMeetingService.GetCountByTime(yearStartTime, endTime, this.ProjectId);//安全领导小组会议
|
||
int yearWeekMeeting = BLL.WeekMeetingService.GetCountByTime(yearStartTime, endTime, this.ProjectId);//周例会
|
||
int yearMonthMeeting = BLL.MonthMeetingService.GetCountByTime(yearStartTime, endTime, this.ProjectId);//月例会
|
||
int yearSpecialMeeting = BLL.SpecialMeetingService.GetCountByTime(yearStartTime, endTime, this.ProjectId);//专题例会
|
||
int yearAttendMeeting = BLL.AttendMeetingService.GetCountByTime(yearStartTime, endTime, this.ProjectId);//其他会议
|
||
int yearClassMeeting = BLL.ClassMeetingService.GetCountByTime(yearStartTime, endTime, this.ProjectId);//班前会
|
||
#endregion
|
||
#region HSE会议 项目总累计数
|
||
int projectSafetyLeaderGroup = BLL.SafetyLeaderGroupMeetingService.GetCountByTime(projectStartTime, endTime, this.ProjectId);//安全领导小组会议
|
||
int projectWeekMeeting = BLL.WeekMeetingService.GetCountByTime(projectStartTime, endTime, this.ProjectId);//周例会
|
||
int projectMonthMeeting = BLL.MonthMeetingService.GetCountByTime(projectStartTime, endTime, this.ProjectId);//月例会
|
||
int projectSpecialMeeting = BLL.SpecialMeetingService.GetCountByTime(projectStartTime, endTime, this.ProjectId);//专题例会
|
||
int projectAttendMeeting = BLL.AttendMeetingService.GetCountByTime(projectStartTime, endTime, this.ProjectId);//其他会议
|
||
int projectClassMeeting = BLL.ClassMeetingService.GetCountByTime(projectStartTime, endTime, this.ProjectId);//班前会
|
||
#endregion
|
||
|
||
Model.Manager_CheckSortC checkSort1 = new Model.Manager_CheckSortC
|
||
{
|
||
CheckSortId = SQLHelper.GetNewID(typeof(Model.Manager_CheckSortC)),
|
||
SortIndex = i,
|
||
CheckType = "HSE会议",
|
||
CheckNumber = safetyLeaderGroup + weekMeeting + monthMeeting + specialMeeting + attendMeeting + classMeeting,
|
||
YearCheckNum = yearSafetyLeaderGroup + yearWeekMeeting + yearMonthMeeting + yearSpecialMeeting + yearSpecialMeeting + yearAttendMeeting + yearClassMeeting,
|
||
TotalCheckNum = projectSafetyLeaderGroup + projectWeekMeeting + projectMonthMeeting + projectSpecialMeeting + projectSpecialMeeting + projectAttendMeeting + projectClassMeeting,
|
||
};
|
||
checkSorts.Add(checkSort1);
|
||
i++;
|
||
Model.Manager_CheckSortC checkSort2 = new Model.Manager_CheckSortC
|
||
{
|
||
CheckSortId = SQLHelper.GetNewID(typeof(Model.Manager_CheckSortC)),
|
||
SortIndex = i,
|
||
CheckType = "开工前HSE检查",
|
||
CheckNumber = BLL.Check_CheckWorkService.GetCountByCheckTime(startTime, endTime, this.ProjectId),
|
||
YearCheckNum = BLL.Check_CheckWorkService.GetCountByCheckTime(yearStartTime, endTime, this.ProjectId),
|
||
TotalCheckNum = BLL.Check_CheckWorkService.GetCountByCheckTime(projectStartTime, endTime, this.ProjectId)
|
||
};
|
||
checkSorts.Add(checkSort2);
|
||
i++;
|
||
//日巡检取HSE日志检查次数
|
||
Model.Manager_CheckSortC checkSort3 = new Model.Manager_CheckSortC
|
||
{
|
||
CheckSortId = SQLHelper.GetNewID(typeof(Model.Manager_CheckSortC)),
|
||
SortIndex = i,
|
||
CheckType = "日巡检",
|
||
CheckNumber = hselogList.Where(x=>x.CompileDate>=startTime && x.CompileDate<=endTime).Sum(x=>x.Num21),
|
||
YearCheckNum = hselogList.Where(x => x.CompileDate >= yearStartTime && x.CompileDate <= endTime).Sum(x => x.Num21),
|
||
TotalCheckNum = hselogList.Where(x => x.CompileDate >= projectStartTime && x.CompileDate <= endTime).Sum(x => x.Num21)
|
||
};
|
||
checkSorts.Add(checkSort3);
|
||
i++;
|
||
|
||
Model.Manager_CheckSortC checkSort4 = new Model.Manager_CheckSortC
|
||
{
|
||
CheckSortId = SQLHelper.GetNewID(typeof(Model.Manager_CheckSortC)),
|
||
SortIndex = i,
|
||
CheckType = "专项检查",
|
||
CheckNumber = BLL.Check_CheckSpecialService.GetCountByCheckTime(startTime, endTime, this.ProjectId),
|
||
YearCheckNum = BLL.Check_CheckSpecialService.GetCountByCheckTime(yearStartTime, endTime, this.ProjectId),
|
||
TotalCheckNum = BLL.Check_CheckSpecialService.GetCountByCheckTime(projectStartTime, endTime, this.ProjectId)
|
||
};
|
||
checkSorts.Add(checkSort4);
|
||
i++;
|
||
Model.Manager_CheckSortC checkSort5 = new Model.Manager_CheckSortC
|
||
{
|
||
CheckSortId = SQLHelper.GetNewID(typeof(Model.Manager_CheckSortC)),
|
||
SortIndex = i,
|
||
CheckType = "节假日前安全检查",
|
||
CheckNumber = BLL.Check_CheckHolidayService.GetCountByCheckTime(startTime, endTime, this.ProjectId),
|
||
YearCheckNum = BLL.Check_CheckHolidayService.GetCountByCheckTime(yearStartTime, endTime, this.ProjectId),
|
||
TotalCheckNum = BLL.Check_CheckHolidayService.GetCountByCheckTime(projectStartTime, endTime, this.ProjectId)
|
||
};
|
||
checkSorts.Add(checkSort5);
|
||
i++;
|
||
|
||
Model.Manager_CheckSortC checkSort6 = new Model.Manager_CheckSortC
|
||
{
|
||
CheckSortId = SQLHelper.GetNewID(typeof(Model.Manager_CheckSortC)),
|
||
SortIndex = i,
|
||
CheckType = "文明施工检查",
|
||
CheckNumber = 0,
|
||
YearCheckNum = 0,
|
||
TotalCheckNum = 0
|
||
};
|
||
checkSorts.Add(checkSort6);
|
||
i++;
|
||
Model.Manager_CheckSortC checkSort7 = new Model.Manager_CheckSortC
|
||
{
|
||
CheckSortId = SQLHelper.GetNewID(typeof(Model.Manager_CheckSortC)),
|
||
SortIndex = i,
|
||
CheckType = "联合检查",
|
||
CheckNumber = BLL.Check_CheckColligationService.GetCountByCheckTime(startTime, endTime, this.ProjectId),
|
||
YearCheckNum = BLL.Check_CheckColligationService.GetCountByCheckTime(yearStartTime, endTime, this.ProjectId),
|
||
TotalCheckNum = BLL.Check_CheckColligationService.GetCountByCheckTime(projectStartTime, endTime, this.ProjectId)
|
||
};
|
||
checkSorts.Add(checkSort7);
|
||
i++;
|
||
|
||
Model.Manager_CheckSortC checkSort11 = new Model.Manager_CheckSortC
|
||
{
|
||
CheckSortId = SQLHelper.GetNewID(typeof(Model.Manager_CheckSortC)),
|
||
SortIndex = i,
|
||
CheckType = "HSE管理文件/方案发布",
|
||
CheckNumber = BLL.ConstructSolutionService.GetConstructSolutionCountByDate(this.ProjectId, startTime, endTime),
|
||
YearCheckNum = BLL.ConstructSolutionService.GetConstructSolutionCountByDate(this.ProjectId, yearStartTime, endTime),
|
||
TotalCheckNum = BLL.ConstructSolutionService.GetConstructSolutionCountByDate(this.ProjectId, projectStartTime, endTime),
|
||
};
|
||
checkSorts.Add(checkSort11);
|
||
i++;
|
||
|
||
this.gvCheckSort.DataSource = checkSorts;
|
||
this.gvCheckSort.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region 4.5项目本月危大工程管理数据
|
||
private void getMonthHazardousGrid()
|
||
{
|
||
var list = db.Solution_LargerHazard.Where(x => x.ProjectId == ProjectId && x.RecordTime >= startTime &&
|
||
x.RecordTime <= endTime && x.States == "3").ToList();
|
||
//加载本月非经专家论证的危大工程数量
|
||
var model = new MonthHazardous()
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
Category = "非经专家论证的危大工程数量",
|
||
ExpertCount = list.Where(x => x.IsArgument == false).ToList().Count()
|
||
};
|
||
monthHazardousList.Add(model);
|
||
//加载本月经专家论证的超危大工程数量
|
||
model = new MonthHazardous()
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
Category = "经专家论证的危大工程数量",
|
||
ExpertCount = list.Where(x => x.IsArgument == true).ToList().Count()
|
||
};
|
||
monthHazardousList.Add(model);
|
||
MonthHazardousGrid.DataSource = monthHazardousList;
|
||
MonthHazardousGrid.DataBind();
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
#region 4.3 本月隐患整改情况
|
||
void GetManager_HiddenDangerEdit()
|
||
{
|
||
var q = from x in db.Manager_HiddenDanger
|
||
where x.MonthReportId == MonthReportId
|
||
select x;
|
||
if (q.Count() > 0) //保存过数据
|
||
{
|
||
//人力投入情况
|
||
List<Model.Manager_HiddenDanger> sorts = (from x in db.Manager_HiddenDanger
|
||
join y in db.Project_ProjectUnit
|
||
on x.UnitId equals y.UnitId
|
||
where x.MonthReportId == MonthReportId && y.ProjectId == this.ProjectId
|
||
orderby y.UnitType
|
||
select x).Distinct().ToList();
|
||
List<Model.Manager_HiddenDanger> personSorts = new List<Model.Manager_HiddenDanger>();
|
||
//var units = from x in db.Project_ProjectUnit
|
||
// where x.ProjectId == this.ProjectId && (x.UnitType == "1" || x.UnitType == "2")
|
||
// orderby x.UnitType
|
||
// select x; //1为总包,2为施工分包
|
||
foreach (var unit in units)
|
||
{
|
||
Model.Manager_HiddenDanger personSort = sorts.FirstOrDefault(x => x.UnitId == unit.UnitId);
|
||
if (personSort != null)
|
||
{
|
||
personSorts.Add(personSort);
|
||
}
|
||
}
|
||
this.GridHiddenDanger.DataSource = personSorts;
|
||
this.GridHiddenDanger.DataBind();
|
||
|
||
}
|
||
else
|
||
{
|
||
GetManager_HiddenDanger();
|
||
}
|
||
}
|
||
|
||
//保存时根据 HSE巡检、专项检查、综合检查(即周检、月检等)、隐患整改(书面整改单)这四项同时抓取数据
|
||
void GetManager_HiddenDanger()
|
||
{
|
||
//安全巡检list
|
||
var HseList = (from x in Funs.DB.View_Hazard_HazardRegister
|
||
where x.ProblemTypes == "1" && x.ProjectId == ProjectId && x.CheckTime >= startTime && x.CheckTime <= endTime
|
||
select x);
|
||
//专项检查
|
||
var CheckSpecialList = from x in db.Check_CheckSpecialDetail
|
||
join y in db.Check_CheckSpecial on x.CheckSpecialId equals y.CheckSpecialId
|
||
where y.ProjectId == ProjectId && y.CheckTime >= startTime && y.CheckTime <= endTime
|
||
select x;
|
||
//综合检查
|
||
var CheckColligationList = from x in db.Check_CheckColligationDetail
|
||
join y in db.Check_CheckColligation on x.CheckColligationId equals y.CheckColligationId
|
||
where y.ProjectId == ProjectId && y.CheckTime >= startTime && y.CheckTime <= endTime
|
||
select x;
|
||
//隐患整改单
|
||
var YhzgdList = from x in db.Check_RectifyNoticesItem
|
||
join y in db.Check_RectifyNotices on x.RectifyNoticesId equals y.RectifyNoticesId
|
||
where y.ProjectId == ProjectId && y.CheckedDate >= startTime && y.CheckedDate <= endTime
|
||
select new { y.UnitId, x.HiddenHazardType, y.States,y.CompleteDate,x.LimitTime };
|
||
|
||
int yhMonthSum = 0, yhYearSum = 0;
|
||
var list = new List<Model.Manager_HiddenDanger>();
|
||
if (units.Count() > 0)
|
||
{
|
||
var i = 1;
|
||
foreach (Model.Project_ProjectUnit u in units)
|
||
{
|
||
var model = new Manager_HiddenDanger
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
UnitId = u.UnitId,
|
||
SortIndex = i
|
||
};
|
||
//HSE巡检(一般和重大)
|
||
//所有数据
|
||
var Commonly1 = HseList.Where(x => x.ResponsibleUnit == u.UnitId && x.Type == 0 && (x.Risk_Level == "一般" || x.Risk_Level==null || x.Risk_Level == "") && x.States == "3").Count();
|
||
var MajorNum1 = HseList.Where(x => x.ResponsibleUnit == u.UnitId && x.Type == 0 && x.Risk_Level == "重大" && x.States == "3").Count();
|
||
|
||
//总数
|
||
var Sum1 = HseList.Where(x => x.ResponsibleUnit == u.UnitId && x.Type == 0).Count();
|
||
//已关闭并且在期限内的
|
||
var Yzg1 = HseList.Where(x => x.ResponsibleUnit == u.UnitId && x.Type == 0 && x.States == "2"
|
||
&& x.RectificationTime<= x.RectificationPeriod ).Count();
|
||
|
||
//专项检查(一般和重大)
|
||
var Commonly2 = CheckSpecialList.Where(x => x.UnitId == u.UnitId && (x.HiddenHazardType == "1"|| x.HiddenHazardType==null || x.HiddenHazardType == "") && x.CompleteStatus == true).Count();
|
||
var MajorNum2 = CheckSpecialList.Where(x => x.UnitId == u.UnitId && x.HiddenHazardType == "3" && x.CompleteStatus == true).Count();
|
||
//总数,已整改
|
||
var Sum2 = CheckSpecialList.Where(x => x.UnitId == u.UnitId).Count();
|
||
//已整改,在期限内的
|
||
var Yzg2 = CheckSpecialList.Where(x => x.UnitId == u.UnitId && x.CompleteStatus == true
|
||
&& x.CompletedDate<=x.Rectification_Date).Count();
|
||
|
||
//综合检查(一般和重大)
|
||
var Commonly3 = CheckColligationList.Where(x => x.UnitId == u.UnitId && (x.HiddenHazardType == "一般" || x.HiddenHazardType==null || x.HiddenHazardType == "") && x.CompleteStatus == true).Count();
|
||
var MajorNum3 = CheckColligationList.Where(x => x.UnitId == u.UnitId && x.HiddenHazardType == "重大" && x.CompleteStatus == true).Count();
|
||
//总数,已整改
|
||
var Sum3 = CheckColligationList.Where(x => x.UnitId == u.UnitId).Count();
|
||
//已整改
|
||
var Yzg3 = CheckColligationList.Where(x => x.UnitId == u.UnitId && x.CompleteStatus == true && x.HandleStep=="5"
|
||
&& x.CompletedDate<= x.LimitedDate).Count();
|
||
|
||
//隐患整改(一般和重大)
|
||
var Commonly4 = YhzgdList.Where(x => x.UnitId == u.UnitId && (x.HiddenHazardType == "一般"
|
||
|| x.HiddenHazardType == null || x.HiddenHazardType == "") && x.States == "5").Count();
|
||
var MajorNum4 = YhzgdList.Where(x => x.UnitId == u.UnitId && x.HiddenHazardType == "重大" && x.States == "5").Count();
|
||
//总数,已整改
|
||
var Sum4 = YhzgdList.Where(x => x.UnitId == u.UnitId).Count();
|
||
var Yzg4 = YhzgdList.Where(x => x.UnitId == u.UnitId && x.States == "5"
|
||
&& x.CompleteDate<= x.LimitTime).Count();
|
||
|
||
|
||
model.CommonlyNum = Commonly1 + Commonly2 + Commonly3 + Commonly4;
|
||
model.MajorNum = MajorNum1 + MajorNum2 + MajorNum3 + MajorNum4;
|
||
|
||
//整改率=已整改/总数
|
||
if ((Sum1 + Sum2 + Sum3 + Sum4) != 0)
|
||
{
|
||
model.ReRate = Math.Round((float)(Yzg1 + Yzg2 + Yzg3 + Yzg4) / (float)(Sum1 + Sum2 + Sum3 + Sum4) * 100, 2).ToString();
|
||
}
|
||
else
|
||
{
|
||
model.ReRate = "0";
|
||
}
|
||
yhMonthSum += Convert.ToInt32(model.CommonlyNum) + Convert.ToInt32(model.MajorNum);
|
||
|
||
list.Add(model);
|
||
i++;
|
||
}
|
||
}
|
||
txtMonthHdangerCount.Text = yhMonthSum.ToString();
|
||
this.GridHiddenDanger.DataSource = list;
|
||
this.GridHiddenDanger.DataBind();
|
||
#region 本年隐患总数
|
||
|
||
//安全巡检list
|
||
var HseListYear = (from x in Funs.DB.View_Hazard_HazardRegister
|
||
where x.ProblemTypes == "1" && x.ProjectId == ProjectId && x.CheckTime >= yearStartTime && x.CheckTime <= endTime
|
||
&& x.States == "3"
|
||
select x).ToList().Count;
|
||
//专项检查
|
||
var CheckSpecialListYear = (from x in db.Check_CheckSpecialDetail
|
||
join y in db.Check_CheckSpecial on x.CheckSpecialId equals y.CheckSpecialId
|
||
where y.ProjectId == ProjectId && y.CheckTime >= yearStartTime && y.CheckTime <= endTime
|
||
&& x.CompleteStatus == true
|
||
select x).ToList().Count;
|
||
//综合检查
|
||
var CheckColligationListYear = (from x in db.Check_CheckColligationDetail
|
||
join y in db.Check_CheckColligation on x.CheckColligationId equals y.CheckColligationId
|
||
where y.ProjectId == ProjectId && y.CheckTime >= yearStartTime && y.CheckTime <= endTime
|
||
&& x.CompleteStatus == true
|
||
select x).ToList().Count;
|
||
//隐患整改单
|
||
var YhzgdListYear = (from x in db.Check_RectifyNoticesItem
|
||
join y in db.Check_RectifyNotices on x.RectifyNoticesId equals y.RectifyNoticesId
|
||
where y.ProjectId == ProjectId && y.CheckedDate >= yearStartTime && y.CheckedDate <= endTime
|
||
&& y.States == "5"
|
||
select new { y.UnitId, x.HiddenHazardType, y.States }).ToList().Count;
|
||
txtYearHdangerCount.Text = (HseListYear + CheckSpecialListYear + CheckColligationListYear + YhzgdListYear).ToString();
|
||
#endregion
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 4.4本月项目作业许可管理数据
|
||
private void getProjectAssignment()
|
||
{
|
||
int num1 = 0, num2 = 0, num3 = 0, num4 = 0, num5 = 0, num6 = 0, num7 = 0, num8 = 0;
|
||
//动火
|
||
var firelist = db.License_FireWork.Where(x => x.States == "3" && x.ProjectId == ProjectId);
|
||
//动土
|
||
var breaklist = db.License_BreakGround.Where(x => x.States == "3" && x.ProjectId == ProjectId);
|
||
//受限空间
|
||
var limitlist = db.License_LimitedSpace.Where(x => x.States == "3" && x.ProjectId == ProjectId);
|
||
//临时用电
|
||
var electrilist = db.License_Electricity.Where(x => x.States == "3" && x.ProjectId == ProjectId);
|
||
//高处作业
|
||
var heightlist = db.License_HeightWork.Where(x => x.States == "3" && x.ProjectId == ProjectId);
|
||
//射线作业
|
||
var radialist = db.License_RadialWork.Where(x => x.States == "3" && x.ProjectId == ProjectId);
|
||
//吊装作业
|
||
var liftinglist = db.License_LiftingWork.Where(x => x.States == "3" && x.ProjectId == ProjectId);
|
||
//夜间施工
|
||
var nightlist = db.License_NightWork.Where(x => x.States == "3" && x.ProjectId == ProjectId);
|
||
//定稿
|
||
var dg = db.License_LicenseManager.Where(x => x.WorkStates == "3" && x.ProjectId == ProjectId);
|
||
|
||
//本月
|
||
num1 = firelist.Where(x => x.ApplyDate >= startTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "aa5b3d17-23bb-4c81-a413-bdbfdd64b38a" && x.CompileDate >= startTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num2 = breaklist.Where(x => x.ApplyDate >= startTime && x.ApplyDate <= endTime).ToList().Count;
|
||
|
||
num3 = limitlist.Where(x => x.ApplyDate >= startTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "9062f7e7-ce35-4e0d-8dbc-760569d2bd1e" && x.CompileDate >= startTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num4 = electrilist.Where(x => x.ApplyDate >= startTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "30f9a07e-289d-4a91-9373-2e3bcef1f1e9" && x.CompileDate >= startTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num5 = heightlist.Where(x => x.ApplyDate >= startTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "4ec4267c-a2e9-4ad2-a95b-7552425acbd4" && x.CompileDate >= startTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num6 = radialist.Where(x => x.ApplyDate >= startTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "4a25f089-ff1d-4a3c-9415-3f4e3d58bb77" && x.CompileDate >= startTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num7 = liftinglist.Where(x => x.ApplyDate >= startTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "3835ad67-1ae2-4b38-9a5d-71deb6d972aa" && x.CompileDate >= startTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num8 = nightlist.Where(x => x.ApplyDate >= startTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "52a699e6-3d0b-4be4-b37d-bf05c41767dd" && x.CompileDate >= startTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
nbFireWorkCount.Text = num1.ToString();
|
||
nbBreakGroundCount.Text = num2.ToString();
|
||
nbLimitedSpaceCount.Text = num3.ToString();
|
||
nbElectricityCount.Text = num4.ToString();
|
||
nbHeightWorkCount.Text = num5.ToString();
|
||
nbRadialWork.Text = num6.ToString();
|
||
nbLiftingWorkCount.Text = num7.ToString();
|
||
nbNightWork.Text = num8.ToString();
|
||
|
||
nbMonthCount.Text = (num1 + num2 + num3 + num4 + num5 + num6 + num7 + num8).ToString();
|
||
|
||
//年度
|
||
num1 = firelist.Where(x => x.ApplyDate >= yearStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "aa5b3d17-23bb-4c81-a413-bdbfdd64b38a" && x.CompileDate >= yearStartTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num2 = breaklist.Where(x => x.ApplyDate >= yearStartTime && x.ApplyDate <= endTime).ToList().Count;
|
||
|
||
num3 = limitlist.Where(x => x.ApplyDate >= yearStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "9062f7e7-ce35-4e0d-8dbc-760569d2bd1e" && x.CompileDate >= yearStartTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num4 = electrilist.Where(x => x.ApplyDate >= yearStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "30f9a07e-289d-4a91-9373-2e3bcef1f1e9").ToList().Count;
|
||
|
||
num5 = heightlist.Where(x => x.ApplyDate >= yearStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "4ec4267c-a2e9-4ad2-a95b-7552425acbd4" && x.CompileDate >= yearStartTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num6 = radialist.Where(x => x.ApplyDate >= yearStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "4a25f089-ff1d-4a3c-9415-3f4e3d58bb77" && x.CompileDate >= yearStartTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num7 = liftinglist.Where(x => x.ApplyDate >= yearStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "3835ad67-1ae2-4b38-9a5d-71deb6d972aa" && x.CompileDate >= yearStartTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num8 = nightlist.Where(x => x.ApplyDate >= yearStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "52a699e6-3d0b-4be4-b37d-bf05c41767dd" && x.CompileDate >= yearStartTime && x.CompileDate <= endTime).ToList().Count;
|
||
nbYearCount.Text = (num1 + num2 + num3 + num4 + num5 + num6 + num7 + num8).ToString();
|
||
|
||
//项目累计
|
||
num1 = firelist.Where(x => x.ApplyDate >= projectStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "aa5b3d17-23bb-4c81-a413-bdbfdd64b38a" && x.CompileDate >= projectStartTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num2 = breaklist.Where(x => x.ApplyDate >= projectStartTime && x.ApplyDate <= endTime).ToList().Count;
|
||
|
||
num3 = limitlist.Where(x => x.ApplyDate >= projectStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "9062f7e7-ce35-4e0d-8dbc-760569d2bd1e" && x.CompileDate >= projectStartTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num4 = electrilist.Where(x => x.ApplyDate >= projectStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "30f9a07e-289d-4a91-9373-2e3bcef1f1e9" && x.CompileDate >= projectStartTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num5 = heightlist.Where(x => x.ApplyDate >= projectStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "4ec4267c-a2e9-4ad2-a95b-7552425acbd4" && x.CompileDate >= projectStartTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num6 = radialist.Where(x => x.ApplyDate >= projectStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "4a25f089-ff1d-4a3c-9415-3f4e3d58bb77" && x.CompileDate >= projectStartTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num7 = liftinglist.Where(x => x.ApplyDate >= projectStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "3835ad67-1ae2-4b38-9a5d-71deb6d972aa" && x.CompileDate >= projectStartTime && x.CompileDate <= endTime).ToList().Count;
|
||
|
||
num8 = nightlist.Where(x => x.ApplyDate >= projectStartTime && x.ApplyDate <= endTime).ToList().Count +
|
||
dg.Where(x => x.LicenseTypeId == "52a699e6-3d0b-4be4-b37d-bf05c41767dd" && x.CompileDate >= projectStartTime && x.CompileDate <= endTime).ToList().Count;
|
||
nbProCount.Text = (num1 + num2 + num3 + num4 + num5 + num6 + num7 + num8).ToString();
|
||
}
|
||
#endregion
|
||
|
||
#region 4.6.1 应急预案发布情况(手动填写)
|
||
private void GetEmergencyPlan()
|
||
{
|
||
int i = 1;
|
||
var model = new Manager_EmergencyPlan()
|
||
{
|
||
Id = SQLHelper.GetNewID(typeof(Model.Manager_CheckSortC)),
|
||
SortIndex = i,
|
||
CaType = "综合应急预案",
|
||
MonthCount = 0,
|
||
YearCount = 0,
|
||
ProCount = 0
|
||
};
|
||
emergencyPlanList.Add(model);
|
||
i++;
|
||
|
||
model = new Manager_EmergencyPlan()
|
||
{
|
||
Id = SQLHelper.GetNewID(typeof(Model.Manager_CheckSortC)),
|
||
SortIndex = i,
|
||
CaType = "专项应急预案",
|
||
MonthCount = 0,
|
||
YearCount = 0,
|
||
ProCount = 0
|
||
};
|
||
emergencyPlanList.Add(model);
|
||
i++;
|
||
|
||
model = new Manager_EmergencyPlan()
|
||
{
|
||
Id = SQLHelper.GetNewID(typeof(Model.Manager_CheckSortC)),
|
||
SortIndex = i,
|
||
CaType = "现场处置方案",
|
||
MonthCount = 0,
|
||
YearCount = 0,
|
||
ProCount = 0
|
||
};
|
||
emergencyPlanList.Add(model);
|
||
i++;
|
||
this.EmergencyPlanGrid.DataSource = emergencyPlanList;
|
||
this.EmergencyPlanGrid.DataBind();
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 4.6.2 应急演练工作情况说明
|
||
private void GetDrillRecordList()
|
||
{
|
||
var query = (from x in db.Emergency_DrillRecordList
|
||
join y in db.Sys_Const on x.DrillRecordType equals y.ConstValue
|
||
where y.GroupId == "DrillRecordType" && x.States == "2" &&
|
||
x.ProjectId == ProjectId && x.DrillRecordDate >= startTime
|
||
&& x.DrillRecordDate <= endTime
|
||
orderby x.DrillRecordDate
|
||
select new
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
Dname = x.DrillRecordName,
|
||
Ddate = x.DrillRecordDate,
|
||
DrillRecordTypeName = y.ConstText,
|
||
PersonNum = x.JointPersonNum,
|
||
DrillCost = x.DrillCost
|
||
});
|
||
foreach (var item in query)
|
||
{
|
||
var model = new Manager_DrillRecordList()
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
Dname = item.Dname,
|
||
Ddate = item.Ddate,
|
||
DrillRecordTypeName = item.DrillRecordTypeName,
|
||
PersonNum = item.PersonNum,
|
||
DrillCost = item.DrillCost
|
||
};
|
||
drillRecordList.Add(model);
|
||
}
|
||
if (drillRecordList.Count == 0)
|
||
{
|
||
DrillRecordListGrid.EmptyText = "<raw><div class=\"grid-empty-text\">暂无数据</div></raw>";
|
||
}
|
||
else {
|
||
this.DrillRecordListGrid.DataSource = drillRecordList;
|
||
this.DrillRecordListGrid.DataBind();
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 4.7 HSE奖励与处罚
|
||
private void GetRewardAndPunishSort()
|
||
{
|
||
|
||
Model.Manager_RewardAndPunishSortC sortC = new Model.Manager_RewardAndPunishSortC
|
||
{
|
||
RewardAndPunishId = SQLHelper.GetNewID(typeof(Model.Manager_RewardAndPunishSortC)),
|
||
RewardNum = BLL.IncentiveNoticeService.GetCountByDate(startTime, endTime, this.ProjectId),
|
||
RewardMoney = BLL.IncentiveNoticeService.GetSumMoneyByDate(startTime, endTime, this.ProjectId),
|
||
ProjectRewardMoney = BLL.IncentiveNoticeService.GetSumMoneyByDate(projectStartTime, endTime, this.ProjectId),
|
||
PunishNum = BLL.PunishNoticeService.GetCountByDate(startTime, endTime, this.ProjectId),
|
||
PunishMoney = BLL.PunishNoticeService.GetSumMoneyByDate(startTime, endTime, this.ProjectId),
|
||
ProjectPunishMoney = BLL.PunishNoticeService.GetSumMoneyByDate(projectStartTime, endTime, this.ProjectId),
|
||
};
|
||
rewardAndPunishSortCs.Add(sortC);
|
||
|
||
this.gvRewardSortAndPunish.DataSource = rewardAndPunishSortCs;
|
||
this.gvRewardSortAndPunish.DataBind();
|
||
}
|
||
|
||
private void jerqueSavePunishList()
|
||
{
|
||
rewardAndPunishSortCs.Clear();
|
||
JArray mergedData = gvRewardSortAndPunish.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
string status = mergedRow.Value<string>("status");
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
int i = mergedRow.Value<int>("index");
|
||
Model.Manager_RewardAndPunishSortC punishSort = new Model.Manager_RewardAndPunishSortC
|
||
{
|
||
RewardAndPunishId = this.gvRewardSortAndPunish.Rows[i].DataKeys[0].ToString(),
|
||
RewardNum = Funs.GetNewInt(values.Value<string>("RewardNum").ToString()),
|
||
RewardMoney = Funs.GetNewDecimal(values.Value<string>("RewardMoney").ToString()),
|
||
ProjectRewardMoney = Funs.GetNewDecimal(values.Value<string>("ProjectRewardMoney").ToString()),
|
||
PunishNum = Funs.GetNewInt(values.Value<string>("PunishNum").ToString()),
|
||
PunishMoney = Funs.GetNewDecimal(values.Value<string>("PunishMoney").ToString()),
|
||
ProjectPunishMoney = Funs.GetNewDecimal(values.Value<string>("ProjectPunishMoney").ToString())
|
||
};
|
||
rewardAndPunishSortCs.Add(punishSort);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 4.8HSE现场其他管理情况
|
||
#region 其他HSE管理情况
|
||
/// <summary>
|
||
/// 增加其他HSE管理情况
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnNewOtherManagement_Click(object sender, EventArgs e)
|
||
{
|
||
jerqueSaveOtherManagementList();
|
||
Model.Manager_Month_OtherManagementC otherManagementSort = new Model.Manager_Month_OtherManagementC
|
||
{
|
||
OtherManagementId = SQLHelper.GetNewID(typeof(Model.Manager_Month_OtherManagementC))
|
||
};
|
||
otherManagements.Add(otherManagementSort);
|
||
this.gvOtherManagement.DataSource = otherManagements;
|
||
this.gvOtherManagement.DataBind();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 检查并保存其他HSE管理情况集合
|
||
/// </summary>
|
||
private void jerqueSaveOtherManagementList()
|
||
{
|
||
otherManagements.Clear();
|
||
JArray mergedData = gvOtherManagement.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
string status = mergedRow.Value<string>("status");
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
int i = mergedRow.Value<int>("index");
|
||
Model.Manager_Month_OtherManagementC otherManagementSort = new Model.Manager_Month_OtherManagementC
|
||
{
|
||
OtherManagementId = this.gvOtherManagement.Rows[i].DataKeys[0].ToString(),
|
||
SortIndex = i,
|
||
ManagementDes = values.Value<string>("ManagementDes").ToString()
|
||
};
|
||
otherManagements.Add(otherManagementSort);
|
||
}
|
||
}
|
||
|
||
protected void gvOtherManagement_RowCommand(object sender, GridCommandEventArgs e)
|
||
{
|
||
jerqueSaveOtherManagementList();
|
||
string rowID = this.gvOtherManagement.DataKeys[e.RowIndex][0].ToString();
|
||
if (e.CommandName == "Delete")
|
||
{
|
||
foreach (var item in otherManagements)
|
||
{
|
||
if (item.OtherManagementId == rowID)
|
||
{
|
||
otherManagements.Remove(item);
|
||
break;
|
||
}
|
||
}
|
||
gvOtherManagement.DataSource = otherManagements;
|
||
gvOtherManagement.DataBind();
|
||
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
|
||
#endregion
|
||
|
||
#region 5.1
|
||
private void GetFiveExpenseList()
|
||
{
|
||
#region 五环(本月)
|
||
decimal? sMonthType1 = 0, sMonthType2 = 0, sMonthType3 = 0, sMonthType4 = 0, sMonthType5 = 0,
|
||
sMonthType6 = 0, sMonthType7 = 0, sMonthType8 = 0, sMonthType9 = 0, sMonthType10 = 0;
|
||
|
||
var payRegistrations = BLL.HseExpenseService.GetPayRegistrationByPayDate(startTime, endTime, this.ProjectId, BLL.Const.UnitId_CWCEC);
|
||
if (payRegistrations != null)
|
||
{
|
||
sMonthType1 += payRegistrations.Sum(x => x.SMonthType1) ?? 0;
|
||
sMonthType2 += payRegistrations.Sum(x => x.SMonthType2) ?? 0;
|
||
sMonthType3 += payRegistrations.Sum(x => x.SMonthType3) ?? 0;
|
||
sMonthType4 += payRegistrations.Sum(x => x.SMonthType4) ?? 0;
|
||
sMonthType5 += payRegistrations.Sum(x => x.SMonthType5) ?? 0;
|
||
sMonthType6 += payRegistrations.Sum(x => x.SMonthType6) ?? 0;
|
||
sMonthType7 += payRegistrations.Sum(x => x.SMonthType7) ?? 0;
|
||
sMonthType8 += payRegistrations.Sum(x => x.SMonthType8) ?? 0;
|
||
sMonthType9 += payRegistrations.Sum(x => x.SMonthType9) ?? 0;
|
||
sMonthType10 += payRegistrations.Sum(x => x.SMonthType10) ?? 0;
|
||
}
|
||
#endregion
|
||
|
||
#region 五环(项目)
|
||
decimal? sProjectType1 = 0, sProjectType2 = 0, sProjectType3 = 0, sProjectType4 = 0, sProjectType5 = 0,
|
||
sProjectType6 = 0, sProjectType7 = 0, sProjectType8 = 0, sProjectType9 = 0, sProjectType10 = 0;
|
||
|
||
var payRegistrationsPro = BLL.PayRegistrationService.GetPayRegistrationByPayDate(projectStartTime, endTime, this.ProjectId, BLL.Const.UnitId_CWCEC);
|
||
if (payRegistrationsPro != null)
|
||
{
|
||
sProjectType1 += payRegistrations.Sum(x => x.SMonthType1) ?? 0;
|
||
sProjectType2 += payRegistrations.Sum(x => x.SMonthType2) ?? 0;
|
||
sProjectType3 += payRegistrations.Sum(x => x.SMonthType3) ?? 0;
|
||
sProjectType4 += payRegistrations.Sum(x => x.SMonthType4) ?? 0;
|
||
sProjectType5 += payRegistrations.Sum(x => x.SMonthType5) ?? 0;
|
||
sProjectType6 += payRegistrations.Sum(x => x.SMonthType6) ?? 0;
|
||
sProjectType7 += payRegistrations.Sum(x => x.SMonthType7) ?? 0;
|
||
sProjectType8 += payRegistrations.Sum(x => x.SMonthType8) ?? 0;
|
||
sProjectType9 += payRegistrations.Sum(x => x.SMonthType9) ?? 0;
|
||
sProjectType10 += payRegistrations.Sum(x => x.SMonthType10) ?? 0;
|
||
}
|
||
#endregion
|
||
|
||
#region 施工分包(本月)
|
||
decimal? sConMonthType1 = 0, sConMonthType2 = 0, sConMonthType3 = 0, sConMonthType4 = 0, sConMonthType5 = 0,
|
||
sConMonthType6 = 0, sConMonthType7 = 0, sConMonthType8 = 0, sConMonthType9 = 0, sConMonthType10 = 0;
|
||
|
||
var payRegistrationsConMonth = BLL.PayRegistrationService.GetConPayRegistrationByPayDate(startTime, endTime, this.ProjectId);
|
||
if (payRegistrationsConMonth != null)
|
||
{
|
||
sConMonthType1 += payRegistrations.Sum(x => x.SMonthType1) ?? 0;
|
||
sConMonthType2 += payRegistrations.Sum(x => x.SMonthType2) ?? 0;
|
||
sConMonthType3 += payRegistrations.Sum(x => x.SMonthType3) ?? 0;
|
||
sConMonthType4 += payRegistrations.Sum(x => x.SMonthType4) ?? 0;
|
||
sConMonthType5 += payRegistrations.Sum(x => x.SMonthType5) ?? 0;
|
||
sConMonthType6 += payRegistrations.Sum(x => x.SMonthType6) ?? 0;
|
||
sConMonthType7 += payRegistrations.Sum(x => x.SMonthType7) ?? 0;
|
||
sConMonthType8 += payRegistrations.Sum(x => x.SMonthType8) ?? 0;
|
||
sConMonthType9 += payRegistrations.Sum(x => x.SMonthType9) ?? 0;
|
||
sConMonthType10 += payRegistrations.Sum(x => x.SMonthType10) ?? 0;
|
||
}
|
||
#endregion
|
||
|
||
#region 施工分包(项目)
|
||
decimal? sConProjectType1 = 0, sConProjectType2 = 0, sConProjectType3 = 0, sConProjectType4 = 0, sConProjectType5 = 0,
|
||
sConProjectType6 = 0, sConProjectType7 = 0, sConProjectType8 = 0, sConProjectType9 = 0, sConProjectType10 = 0;
|
||
|
||
var payRegistrationsConPro = BLL.PayRegistrationService.GetConPayRegistrationByPayDate(projectStartTime, endTime, this.ProjectId);
|
||
if (payRegistrationsConPro != null)
|
||
{
|
||
sConProjectType1 += payRegistrations.Sum(x => x.SMonthType1) ?? 0;
|
||
sConProjectType2 += payRegistrations.Sum(x => x.SMonthType2) ?? 0;
|
||
sConProjectType3 += payRegistrations.Sum(x => x.SMonthType3) ?? 0;
|
||
sConProjectType4 += payRegistrations.Sum(x => x.SMonthType4) ?? 0;
|
||
sConProjectType5 += payRegistrations.Sum(x => x.SMonthType5) ?? 0;
|
||
sConProjectType6 += payRegistrations.Sum(x => x.SMonthType6) ?? 0;
|
||
sConProjectType7 += payRegistrations.Sum(x => x.SMonthType7) ?? 0;
|
||
sConProjectType8 += payRegistrations.Sum(x => x.SMonthType8) ?? 0;
|
||
sConProjectType9 += payRegistrations.Sum(x => x.SMonthType9) ?? 0;
|
||
sConProjectType10 += payRegistrations.Sum(x => x.SMonthType10) ?? 0;
|
||
}
|
||
#endregion
|
||
|
||
int i = 0;
|
||
var fiveExpense1 = new Model.Manager_Month_FiveExpenseC
|
||
{
|
||
FiveExpenseId = SQLHelper.GetNewID(typeof(Model.Manager_Month_FiveExpenseC)),
|
||
SortIndex = i,
|
||
InvestmentProject = "完善、改造和维护安全防护设备、设施",
|
||
PlanCostMonth = sMonthType1,//五环工程(本月)
|
||
PlanCostYear = sProjectType1, //五环工程(项目累计)
|
||
ActualCostMonth = sConMonthType1,//施工分包商(本月)
|
||
ActualCostYear = sConProjectType1//施工分包商(项目累计)
|
||
};
|
||
fiveExpenses.Add(fiveExpense1);
|
||
i++;
|
||
|
||
fiveExpense1 = new Model.Manager_Month_FiveExpenseC
|
||
{
|
||
FiveExpenseId = SQLHelper.GetNewID(typeof(Model.Manager_Month_FiveExpenseC)),
|
||
SortIndex = i,
|
||
InvestmentProject = "应急救援和演练",
|
||
PlanCostMonth = sMonthType2,//五环工程(本月)
|
||
PlanCostYear = sProjectType2, //五环工程(项目累计)
|
||
ActualCostMonth = sConMonthType2,//施工分包商(本月)
|
||
ActualCostYear = sConProjectType2//施工分包商(项目累计)
|
||
};
|
||
fiveExpenses.Add(fiveExpense1);
|
||
i++;
|
||
|
||
fiveExpense1 = new Model.Manager_Month_FiveExpenseC
|
||
{
|
||
FiveExpenseId = SQLHelper.GetNewID(typeof(Model.Manager_Month_FiveExpenseC)),
|
||
SortIndex = i,
|
||
InvestmentProject = "重大危险源管理;隐患整改;安全生产信息化",
|
||
PlanCostMonth = sMonthType3,//五环工程(本月)
|
||
PlanCostYear = sProjectType3, //五环工程(项目累计)
|
||
ActualCostMonth = sConMonthType3,//施工分包商(本月)
|
||
ActualCostYear = sConProjectType3//施工分包商(项目累计)
|
||
};
|
||
fiveExpenses.Add(fiveExpense1);
|
||
i++;
|
||
|
||
fiveExpense1 = new Model.Manager_Month_FiveExpenseC
|
||
{
|
||
FiveExpenseId = SQLHelper.GetNewID(typeof(Model.Manager_Month_FiveExpenseC)),
|
||
SortIndex = i,
|
||
InvestmentProject = "安全检查、评估评价、咨询与标准化建设",
|
||
PlanCostMonth = sMonthType4,//五环工程(本月)
|
||
PlanCostYear = sProjectType4, //五环工程(项目累计)
|
||
ActualCostMonth = sConMonthType4,//施工分包商(本月)
|
||
ActualCostYear = sConProjectType4//施工分包商(项目累计)
|
||
};
|
||
fiveExpenses.Add(fiveExpense1);
|
||
i++;
|
||
|
||
fiveExpense1 = new Model.Manager_Month_FiveExpenseC
|
||
{
|
||
FiveExpenseId = SQLHelper.GetNewID(typeof(Model.Manager_Month_FiveExpenseC)),
|
||
SortIndex = i,
|
||
InvestmentProject = "作业人员防护用品",
|
||
PlanCostMonth = sMonthType5,//五环工程(本月)
|
||
PlanCostYear = sProjectType5, //五环工程(项目累计)
|
||
ActualCostMonth = sConMonthType5,//施工分包商(本月)
|
||
ActualCostYear = sConProjectType5//施工分包商(项目累计)
|
||
};
|
||
fiveExpenses.Add(fiveExpense1);
|
||
i++;
|
||
|
||
fiveExpense1 = new Model.Manager_Month_FiveExpenseC
|
||
{
|
||
FiveExpenseId = SQLHelper.GetNewID(typeof(Model.Manager_Month_FiveExpenseC)),
|
||
SortIndex = i,
|
||
InvestmentProject = "安全生产宣传、教育、培训及奖励",
|
||
PlanCostMonth = sMonthType6,//五环工程(本月)
|
||
PlanCostYear = sProjectType6, //五环工程(项目累计)
|
||
ActualCostMonth = sConMonthType6,//施工分包商(本月)
|
||
ActualCostYear = sConProjectType6//施工分包商(项目累计)
|
||
};
|
||
fiveExpenses.Add(fiveExpense1);
|
||
i++;
|
||
|
||
fiveExpense1 = new Model.Manager_Month_FiveExpenseC
|
||
{
|
||
FiveExpenseId = SQLHelper.GetNewID(typeof(Model.Manager_Month_FiveExpenseC)),
|
||
SortIndex = i,
|
||
InvestmentProject = "“四新”推广应用支出",
|
||
PlanCostMonth = sMonthType7,//五环工程(本月)
|
||
PlanCostYear = sProjectType7, //五环工程(项目累计)
|
||
ActualCostMonth = sConMonthType7,//施工分包商(本月)
|
||
ActualCostYear = sConProjectType7//施工分包商(项目累计)
|
||
};
|
||
fiveExpenses.Add(fiveExpense1);
|
||
i++;
|
||
|
||
fiveExpense1 = new Model.Manager_Month_FiveExpenseC
|
||
{
|
||
FiveExpenseId = SQLHelper.GetNewID(typeof(Model.Manager_Month_FiveExpenseC)),
|
||
SortIndex = i,
|
||
InvestmentProject = "安全设施及特种设备检测检验、检定校准",
|
||
PlanCostMonth = sMonthType8,//五环工程(本月)
|
||
PlanCostYear = sProjectType8, //五环工程(项目累计)
|
||
ActualCostMonth = sConMonthType8,//施工分包商(本月)
|
||
ActualCostYear = sConProjectType8//施工分包商(项目累计)
|
||
};
|
||
fiveExpenses.Add(fiveExpense1);
|
||
i++;
|
||
|
||
fiveExpense1 = new Model.Manager_Month_FiveExpenseC
|
||
{
|
||
FiveExpenseId = SQLHelper.GetNewID(typeof(Model.Manager_Month_FiveExpenseC)),
|
||
SortIndex = i,
|
||
InvestmentProject = "安全生产责任保险",
|
||
PlanCostMonth = sMonthType9,//五环工程(本月)
|
||
PlanCostYear = sProjectType9, //五环工程(项目累计)
|
||
ActualCostMonth = sConMonthType9,//施工分包商(本月)
|
||
ActualCostYear = sConProjectType9//施工分包商(项目累计)
|
||
};
|
||
fiveExpenses.Add(fiveExpense1);
|
||
i++;
|
||
|
||
fiveExpense1 = new Model.Manager_Month_FiveExpenseC
|
||
{
|
||
FiveExpenseId = SQLHelper.GetNewID(typeof(Model.Manager_Month_FiveExpenseC)),
|
||
SortIndex = i,
|
||
InvestmentProject = "其他与安全生产直接相关的支出",
|
||
PlanCostMonth = sMonthType10,//五环工程(本月)
|
||
PlanCostYear = sProjectType10, //五环工程(项目累计)
|
||
ActualCostMonth = sConMonthType10,//施工分包商(本月)
|
||
ActualCostYear = sConProjectType10//施工分包商(项目累计)
|
||
};
|
||
fiveExpenses.Add(fiveExpense1);
|
||
i++;
|
||
this.gvFiveExpenseC.DataSource = fiveExpenses;
|
||
this.gvFiveExpenseC.DataBind();
|
||
|
||
OutputgvFiveExpenseCSummaryData();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 求和
|
||
/// </summary>
|
||
private void OutputgvFiveExpenseCSummaryData()
|
||
{
|
||
JObject summary = new JObject();
|
||
|
||
decimal TotalPlanCostMonth = 0, TotalPlanCostYear = 0, TotalActualCostMonth = 0, TotalActualCostYear = 0;
|
||
foreach (JObject mergedRow in gvFiveExpenseC.GetMergedData())
|
||
{
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
if (!string.IsNullOrEmpty(values["PlanCostMonth"].ToString()))
|
||
{
|
||
TotalPlanCostMonth += values.Value<decimal>("PlanCostMonth");
|
||
}
|
||
if (!string.IsNullOrEmpty(values["PlanCostYear"].ToString()))
|
||
{
|
||
TotalPlanCostYear += values.Value<decimal>("PlanCostYear");
|
||
}
|
||
if (!string.IsNullOrEmpty(values["ActualCostMonth"].ToString()))
|
||
{
|
||
TotalActualCostMonth += values.Value<decimal>("ActualCostMonth");
|
||
}
|
||
if (!string.IsNullOrEmpty(values["ActualCostYear"].ToString()))
|
||
{
|
||
TotalActualCostYear += values.Value<decimal>("ActualCostYear");
|
||
}
|
||
}
|
||
summary.Add("InvestmentProject", "合计");
|
||
summary.Add("PlanCostMonth", TotalPlanCostMonth.ToString("F2"));
|
||
summary.Add("PlanCostYear", TotalPlanCostYear.ToString("F2"));
|
||
summary.Add("ActualCostMonth", TotalActualCostMonth.ToString("F2"));
|
||
summary.Add("ActualCostYear", TotalActualCostYear.ToString("F2"));
|
||
|
||
gvFiveExpenseC.SummaryData = summary;
|
||
}
|
||
#endregion
|
||
|
||
#region 6.1未遂事件统计
|
||
private void GetAttempted()
|
||
{
|
||
var list = db.Accident_AccidentHandle.Where(x => x.ProjectId == ProjectId);
|
||
//五环本月
|
||
nbWhMonthNum.Text = list.Where(x => x.AccidentDate >= startTime && x.AccidentDate <= endTime && x.UnitId == Const.UnitId_CWCEC).Count()
|
||
.ToString();
|
||
//五环本年
|
||
nbWhYearNum.Text = list.Where(x => x.AccidentDate >= yearStartTime && x.AccidentDate <= endTime && x.UnitId == Const.UnitId_CWCEC).Count()
|
||
.ToString();
|
||
//分包商本月
|
||
nbFbsMonthNum.Text = list.Where(x => x.AccidentDate >= startTime && x.AccidentDate <= endTime && x.UnitId != Const.UnitId_CWCEC).Count()
|
||
.ToString();
|
||
//分包商本年
|
||
nbFbsYearNum.Text = list.Where(x => x.AccidentDate >= yearStartTime && x.AccidentDate <= endTime && x.UnitId != Const.UnitId_CWCEC).Count()
|
||
.ToString();
|
||
//项目累计
|
||
nbProNum.Text = list.Where(x => x.AccidentDate >= projectStartTime && x.AccidentDate <= endTime).Count()
|
||
.ToString();
|
||
}
|
||
#endregion
|
||
|
||
#region 6.1 2 本月伤害事故统计
|
||
/// <summary>
|
||
/// 本月伤害事故统计
|
||
/// </summary>
|
||
private void GetInjuryAccident()
|
||
{
|
||
List<Model.Accident_AccidentReport> reports = AccidentReportService.GetAccidentReportsByAccidentTime(startTime, endTime, ProjectId);
|
||
List<Model.Accident_AccidentReport> deathReports = AccidentReportService.GetAccidentReportsByAccidentType("1", startTime, endTime, ProjectId);
|
||
int i = 0;
|
||
Model.Manager_Month_InjuryAccidentC injury = new Model.Manager_Month_InjuryAccidentC
|
||
{
|
||
InjuryAccidentId = SQLHelper.GetNewID(typeof(Model.Manager_Month_InjuryAccidentC)),
|
||
UnitName = "五环",
|
||
FirstAidDressing = 0, //
|
||
MedicalTreatment = 0,//
|
||
WorkLimitation = 0,//
|
||
LossCount=0,
|
||
LossPerson = (from x in reports where x.UnitId == Const.UnitId_CWCEC select x.PeopleNum).Sum(),
|
||
LossWorkTime = (from x in reports where x.UnitId == Const.UnitId_CWCEC select x.WorkingHoursLoss).Sum(),
|
||
LossEconomy = (from x in reports where x.UnitId == Const.UnitId_CWCEC select x.EconomicLoss).Sum() + (from x in reports where x.UnitId == Const.UnitId_CWCEC select x.EconomicOtherLoss).Sum(),
|
||
DeathCount=0,
|
||
DeathPerson = (from x in deathReports where x.UnitId == Const.UnitId_CWCEC select x.PeopleNum).Sum(),
|
||
DeathWorkTime = (from x in deathReports where x.UnitId == Const.UnitId_CWCEC select x.WorkingHoursLoss).Sum(),
|
||
DeathEconomy = (from x in deathReports where x.UnitId == Const.UnitId_CWCEC select x.EconomicLoss).Sum() + (from x in deathReports where x.UnitId == Const.UnitId_CWCEC select x.EconomicOtherLoss).Sum(),
|
||
};
|
||
injuryAccidents.Add(injury);
|
||
i++;
|
||
Model.Manager_Month_InjuryAccidentC injury2 = new Model.Manager_Month_InjuryAccidentC
|
||
{
|
||
InjuryAccidentId = SQLHelper.GetNewID(typeof(Model.Manager_Month_InjuryAccidentC)),
|
||
UnitName = "分包商",
|
||
FirstAidDressing = 0, //
|
||
MedicalTreatment = 0,//
|
||
WorkLimitation = 0,//
|
||
LossCount = 0,
|
||
DeathCount = 0,
|
||
LossPerson = (from x in reports
|
||
join y in Funs.DB.Project_ProjectUnit on x.UnitId equals y.UnitId
|
||
where y.UnitType == Const.ProjectUnitType_2
|
||
select x.PeopleNum).Sum(),
|
||
LossWorkTime = (from x in reports
|
||
join y in Funs.DB.Project_ProjectUnit on x.UnitId equals y.UnitId
|
||
where y.UnitType == Const.ProjectUnitType_2
|
||
select x.WorkingHoursLoss).Sum(),
|
||
LossEconomy = (from x in reports
|
||
join y in Funs.DB.Project_ProjectUnit on x.UnitId equals y.UnitId
|
||
where y.UnitType == Const.ProjectUnitType_2
|
||
select x.EconomicLoss).Sum() + (from x in reports
|
||
join y in Funs.DB.Project_ProjectUnit on x.UnitId equals y.UnitId
|
||
where y.UnitType == Const.ProjectUnitType_2
|
||
select x.EconomicOtherLoss).Sum(),
|
||
DeathPerson = (from x in deathReports
|
||
join y in Funs.DB.Project_ProjectUnit on x.UnitId equals y.UnitId
|
||
where y.UnitType == Const.ProjectUnitType_2
|
||
select x.PeopleNum).Sum(),
|
||
DeathWorkTime = (from x in deathReports
|
||
join y in Funs.DB.Project_ProjectUnit on x.UnitId equals y.UnitId
|
||
where y.UnitType == Const.ProjectUnitType_2
|
||
select x.WorkingHoursLoss).Sum(),
|
||
DeathEconomy = (from x in deathReports
|
||
join y in Funs.DB.Project_ProjectUnit on x.UnitId equals y.UnitId
|
||
where y.UnitType == Const.ProjectUnitType_2
|
||
select x.EconomicLoss).Sum() + (from x in deathReports
|
||
join y in Funs.DB.Project_ProjectUnit on x.UnitId equals y.UnitId
|
||
where y.UnitType == Const.ProjectUnitType_2
|
||
select x.EconomicOtherLoss).Sum(),
|
||
};
|
||
injuryAccidents.Add(injury2);
|
||
|
||
this.gvInjuryAccident.DataSource = injuryAccidents;
|
||
this.gvInjuryAccident.DataBind();
|
||
|
||
OutputSummaryData();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 求和
|
||
/// </summary>
|
||
private void OutputSummaryData()
|
||
{
|
||
JObject summary = new JObject();
|
||
|
||
int TotalAttemptedIncidents = 0, TotalFirstAidDressing = 0, TotalMedicalTreatment = 0, TotalWorkLimitation = 0, TotalLossPerson = 0, TotalDeathPerson = 0;
|
||
decimal TotalLossWorkTime = 0, TotalLossEconomy = 0, TotalDeathWorkTime = 0, TotalDeathEconomy = 0 ,TotalLossCount=0,TotalDeathCount=0;
|
||
foreach (JObject mergedRow in gvInjuryAccident.GetMergedData())
|
||
{
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
if (!string.IsNullOrEmpty(values["FirstAidDressing"].ToString()))
|
||
{
|
||
TotalFirstAidDressing += values.Value<int>("FirstAidDressing");
|
||
}
|
||
if (!string.IsNullOrEmpty(values["MedicalTreatment"].ToString()))
|
||
{
|
||
TotalMedicalTreatment += values.Value<int>("MedicalTreatment");
|
||
}
|
||
if (!string.IsNullOrEmpty(values["WorkLimitation"].ToString()))
|
||
{
|
||
TotalWorkLimitation += values.Value<int>("WorkLimitation");
|
||
}
|
||
if (!string.IsNullOrEmpty(values["LossPerson"].ToString()))
|
||
{
|
||
TotalLossPerson += values.Value<int>("LossPerson");
|
||
}
|
||
if (!string.IsNullOrEmpty(values["LossWorkTime"].ToString()))
|
||
{
|
||
TotalLossWorkTime += values.Value<decimal>("LossWorkTime");
|
||
}
|
||
if (!string.IsNullOrEmpty(values["LossEconomy"].ToString()))
|
||
{
|
||
TotalLossEconomy += values.Value<decimal>("LossEconomy");
|
||
}
|
||
if (!string.IsNullOrEmpty(values["DeathPerson"].ToString()))
|
||
{
|
||
TotalDeathPerson += values.Value<int>("DeathPerson");
|
||
}
|
||
if (!string.IsNullOrEmpty(values["DeathWorkTime"].ToString()))
|
||
{
|
||
TotalDeathWorkTime += values.Value<decimal>("DeathWorkTime");
|
||
}
|
||
if (!string.IsNullOrEmpty(values["DeathEconomy"].ToString()))
|
||
{
|
||
TotalDeathEconomy += values.Value<decimal>("DeathEconomy");
|
||
}
|
||
if (!string.IsNullOrEmpty(values["LossCount"].ToString()))
|
||
{
|
||
TotalLossCount += values.Value<decimal>("LossCount");
|
||
}
|
||
if (!string.IsNullOrEmpty(values["DeathCount"].ToString()))
|
||
{
|
||
TotalDeathCount += values.Value<decimal>("DeathCount");
|
||
}
|
||
}
|
||
summary.Add("UnitName", "项目合计");
|
||
summary.Add("AttemptedIncidents", TotalAttemptedIncidents.ToString("F2"));
|
||
summary.Add("FirstAidDressing", TotalFirstAidDressing.ToString("F2"));
|
||
summary.Add("MedicalTreatment", TotalMedicalTreatment.ToString("F2"));
|
||
summary.Add("WorkLimitation", TotalWorkLimitation.ToString("F2"));
|
||
summary.Add("LossCount", TotalLossCount.ToString("F2"));
|
||
summary.Add("LossPerson", TotalLossPerson.ToString("F2"));
|
||
summary.Add("LossWorkTime", TotalLossWorkTime.ToString("F2"));
|
||
summary.Add("LossEconomy", TotalLossEconomy.ToString("F2"));
|
||
summary.Add("DeathCount", TotalDeathCount.ToString("F2"));
|
||
summary.Add("DeathPerson", TotalDeathPerson.ToString("F2"));
|
||
summary.Add("DeathWorkTime", TotalDeathWorkTime.ToString("F2"));
|
||
summary.Add("DeathEconomy", TotalDeathEconomy.ToString("F2"));
|
||
|
||
gvInjuryAccident.SummaryData = summary;
|
||
}
|
||
#endregion
|
||
|
||
#region 6.3 HSE目标实现情况
|
||
private void GetGalachList()
|
||
{
|
||
|
||
var GalachModel = new Galach()
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
GoName = "项目HSE检查计划完成率",
|
||
GoTarget = 0,
|
||
GoValue = "≥90%"
|
||
|
||
};
|
||
galachList.Add(GalachModel);
|
||
|
||
|
||
GalachModel = new Galach()
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
GoName = "百万工时总可记录事件率<br/>(总可记录事件人数 / 总工时)×106",
|
||
GoTarget = 0,
|
||
GoValue = "≤2"
|
||
|
||
};
|
||
galachList.Add(GalachModel);
|
||
|
||
GalachModel = new Galach()
|
||
{
|
||
Id = Guid.NewGuid().ToString(),
|
||
GoName = "百万工时事故发生频率<br/>(损失工时伤害事故起数 / 总工时)×106",
|
||
GoTarget = 0,
|
||
GoValue = "≤15"
|
||
|
||
};
|
||
galachList.Add(GalachModel);
|
||
|
||
if (galachList.Count > 0)
|
||
{
|
||
GoalachGrid.DataSource = galachList;
|
||
GoalachGrid.DataBind();
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
#region 转换字符串
|
||
/// <summary>
|
||
/// 把单位Id转换为单位名称
|
||
/// </summary>
|
||
/// <param name="UnitId"></param>
|
||
/// <returns></returns>
|
||
protected string ConvertUnitName(object UnitId)
|
||
{
|
||
if (UnitId != null)
|
||
{
|
||
var u = unitList.FirstOrDefault(x => x.UnitId == UnitId.ToString());
|
||
if (u != null)
|
||
{
|
||
return u.UnitName;
|
||
}
|
||
}
|
||
return "";
|
||
}
|
||
#endregion
|
||
|
||
|
||
}
|
||
} |