20230920 HSE管理月报

This commit is contained in:
2023-09-20 13:55:00 +08:00
parent 47f9a0e959
commit 374cad03f1
48 changed files with 6674 additions and 8104 deletions
@@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using BLL;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace FineUIPro.Web.HSSE.Manager
{
@@ -15,7 +13,7 @@ namespace FineUIPro.Web.HSSE.Manager
/// <summary>
/// 月报告查主键
/// </summary>
public string MonthReportId
public string newKeyID
{
get
{
@@ -52,19 +50,14 @@ namespace FineUIPro.Web.HSSE.Manager
#region
/// <summary>
/// 5.1.2 本月文件、方案修编情况说明集合
/// 6.1 五环HSE费用投入集合
/// </summary>
private static List<Model.Manager_Month_PlanC> plans = new List<Model.Manager_Month_PlanC>();
private static List<Model.Manager_Month_FiveExpenseC> fiveExpenses = new List<Model.Manager_Month_FiveExpenseC>();
/// <summary>
/// 5.2.2 详细审查记录集合
/// 6.2 分包商HSE费用投入集合
/// </summary>
private static List<Model.Manager_Month_ReviewRecordC> reviewRecords = new List<Model.Manager_Month_ReviewRecordC>();
/// <summary>
/// 5.3 HSSE文件管理集合
/// </summary>
private static List<Model.Manager_Month_FileManageC> fileManages = new List<Model.Manager_Month_FileManageC>();
private static List<Model.Manager_Month_SubExpenseC> subExpenses = new List<Model.Manager_Month_SubExpenseC>();
#endregion
@@ -75,10 +68,9 @@ namespace FineUIPro.Web.HSSE.Manager
{
if (!IsPostBack)
{
plans.Clear();
reviewRecords.Clear();
fileManages.Clear();
this.MonthReportId = Request.Params["monthReportId"];
fiveExpenses.Clear();
subExpenses.Clear();
this.newKeyID = Request.Params["monthReportId"];
this.ProjectId = this.CurrUser.LoginProjectId;
DateTime months = Convert.ToDateTime(Request.Params["months"]);
startTime = Convert.ToDateTime(Request.Params["startTime"]);
@@ -93,408 +85,320 @@ namespace FineUIPro.Web.HSSE.Manager
}
if (monthReport != null)
{
this.MonthReportId = monthReport.MonthReportId;
this.newKeyID = monthReport.MonthReportId;
this.ProjectId = monthReport.ProjectId;
months = Convert.ToDateTime(monthReport.Months);
Model.SGGLDB db = Funs.DB;
//5.1.2 本月文件、方案修编情况说明
plans = (from x in db.Manager_Month_PlanC where x.MonthReportId == MonthReportId orderby x.SortIndex select x).ToList();
if (plans.Count > 0)
fiveExpenses = BLL.FiveExpenseCService.GetFiveExpenseByMonthReportId(this.newKeyID);
if (fiveExpenses.Count > 0)
{
this.gvMonthPlan.DataSource = plans;
this.gvMonthPlan.DataBind();
this.gvFiveExpenseC.DataSource = fiveExpenses;
this.gvFiveExpenseC.DataBind();
OutputSummaryData();
}
else
{
GetPlanSort();
GetFiveExpenseList();
}
//5.2.2 详细审查记录
reviewRecords = (from x in db.Manager_Month_ReviewRecordC where x.MonthReportId == MonthReportId orderby x.SortIndex select x).ToList();
if (reviewRecords.Count > 0)
subExpenses = BLL.SubExpenseCService.GetSubExpenseByMonthReportId(this.newKeyID);
if (subExpenses.Count>0)
{
this.gvReviewRecord.DataSource = reviewRecords;
this.gvReviewRecord.DataBind();
this.gvSubExpenseC.DataSource = subExpenses;
this.gvSubExpenseC.DataBind();
OutputSubSummaryData();
}
else
{
GetReviewRecordSort();
GetSubExpenseList();
}
}
else
{
//施工HSE实施计划数量
//List<Model.ActionPlan_ActionPlanList> actionPlans = BLL.ActionPlanListService.GetActionPlanListsByDate(startTime, endTime, this.ProjectId);
//int actionPlanNum = actionPlans.Count;
////HSE管理规定数量
//List<Model.ActionPlan_ManagerRule> hSERules = BLL.ActionPlan_ManagerRuleService.GetManagerRuleListsByDate(startTime, endTime, this.ProjectId);
//int hSERuleNum = hSERules.Count;
//int constructSolutionNum = BLL.ConstructSolutionService.GetConstructSolutionCountByDate(this.ProjectId, startTime, endTime);
//int subUnitQualityAuditDetailNum = BLL.SubUnitQualityAuditDetailService.GetCountByDate(this.ProjectId, startTime, endTime);
//int equipmentQualityAuditDetailNum = BLL.EquipmentQualityAuditDetailService.GetCountByDate(this.ProjectId, startTime, endTime);
//int personQualityAuditDetailNum = BLL.PersonQualityService.GetCountByDate(this.ProjectId, startTime, endTime);
//int generalEquipmentQualityNum = BLL.GeneralEquipmentQualityService.GetSumCountByDate(this.ProjectId, startTime, endTime);
GetPlanSort();
GetReviewRecordSort();
GetFiveExpenseList(); //费用投入
GetSubExpenseList(); //本月项目分包商HSE费用支付统计
}
}
}
#endregion
#region HSE管理文件
#region HSE费用支付统计
/// <summary>
/// 显示本月文件、方案修编情况说明
/// 费用投入
/// </summary>
private void GetPlanSort()
private void GetFiveExpenseList()
{
List<Model.ActionPlan_ActionPlanList> actionList = BLL.ActionPlanListService.GetActionPlanListsByDate(startTime, endTime, this.ProjectId);
//施工计划
if (actionList.Count > 0)
#region
decimal? sMonthType1 = 0, sMonthType2 = 0, sMonthType3 = 0, sMonthType4 = 0, sMonthType5 = 0, sMonthType6 = 0;
decimal? tMonthType1 = 0;
List<Model.CostGoods_PayRegistration> payRegistrations = BLL.PayRegistrationService.GetPayRegistrationByPayDate(startTime, endTime, this.ProjectId, BLL.Const.UnitId_CWCEC);
if (payRegistrations != null)
{
foreach (Model.ActionPlan_ActionPlanList item in actionList)
foreach (var item in payRegistrations)
{
Model.Manager_Month_PlanC plan = new Model.Manager_Month_PlanC
{
PlanId = item.ActionPlanListId,
PlanName = item.ActionPlanListName
};
List<Model.Sys_User> userSelect = (from x in Funs.DB.Sys_User
join y in Funs.DB.Sys_FlowOperate
on x.UserId equals y.OperaterId
join z in Funs.DB.Project_ProjectUser
on y.OperaterId equals z.UserId
where (z.RoleId.Contains(BLL.Const.HSSEEngineer) || z.RoleId.Contains(BLL.Const.HSSEManager)) && y.MenuId == BLL.Const.ProjectActionPlanListMenuId && y.DataId == item.ActionPlanListId
select x).Distinct().ToList();
if (userSelect.Count() > 0)
{
List<Model.Sys_User> users = userSelect.Distinct().ToList();
string names = string.Empty;
foreach (var user in users)
{
names += user.UserName + ",";
}
if (!string.IsNullOrEmpty(names))
{
names = names.Substring(0, names.LastIndexOf(","));
}
plan.CompileMan = names;
}
if (item.CompileDate != null)
{
plan.CompileDate = string.Format("{0:yyyy-MM-dd}", item.CompileDate);
}
plans.Add(plan);
sMonthType1 += item.SMonthType1_1 + item.SMonthType1_2 + item.SMonthType1_3 + item.SMonthType1_4 + item.SMonthType1_5 + item.SMonthType1_6 + item.SMonthType1_7 + item.SMonthType1_8 + item.SMonthType1_9 + item.SMonthType1_10 + item.SMonthType1_11 + item.SMonthType1_12 + item.SMonthType1_13 + item.SMonthType1_14 + item.SMonthType1_15 + item.SMonthType1_16;
sMonthType2 += item.SMonthType2_1 + item.SMonthType2_2 + item.SMonthType2_3 + item.SMonthType2_4;
sMonthType3 += item.SMonthType3_1 + item.SMonthType3_2 + item.SMonthType3_3 + item.SMonthType3_4 + item.SMonthType3_5 + item.SMonthType3_6;
sMonthType4 += item.SMonthType4_1 + item.SMonthType4_2 + item.SMonthType4_3 + item.SMonthType4_4 + item.SMonthType4_5 + item.SMonthType4_6 + item.SMonthType4_7 + item.SMonthType4_8 + item.SMonthType4_9 + item.SMonthType4_10 + item.SMonthType4_11 + item.SMonthType4_12 + item.SMonthType4_13 + item.SMonthType4_14 + item.SMonthType4_15 + item.SMonthType4_16 + item.SMonthType4_17 + item.SMonthType4_18 + item.SMonthType4_19 + item.SMonthType4_20 + item.SMonthType4_21 + item.SMonthType4_22 + item.SMonthType4_23 + item.SMonthType4_24 + item.SMonthType4_25 + item.SMonthType4_26 + item.SMonthType4_27 + item.SMonthType4_28 + item.SMonthType4_29 + item.SMonthType4_30 + item.SMonthType4_31 + item.SMonthType4_32 + item.SMonthType4_33 + item.SMonthType4_34 + item.SMonthType4_35 + item.SMonthType4_35 + item.SMonthType4_36 + item.SMonthType4_37 + item.SMonthType4_38 + item.SMonthType4_39 + item.SMonthType4_40;
sMonthType5 += item.SMonthType5_1 + item.SMonthType5_2 + item.SMonthType5_3 + item.SMonthType5_4 + item.SMonthType5_5 + item.SMonthType5_6;
sMonthType6 += item.SMonthType6_1 + item.SMonthType6_2 + item.SMonthType6_3;
tMonthType1 += item.TMonthType1_1 + item.TMonthType1_2 + item.TMonthType1_3 + item.TMonthType1_4 + item.TMonthType1_5 + item.TMonthType1_6 + item.TMonthType1_7 + item.TMonthType1_8 + item.TMonthType1_9 + item.TMonthType1_10 + item.TMonthType1_11;
}
}
//管理规定
List<Model.ActionPlan_ManagerRule> hseRuleList = BLL.ActionPlan_ManagerRuleService.GetManagerRuleListsByDate(startTime, endTime, this.ProjectId);
if (hseRuleList.Count > 0)
{
foreach (Model.ActionPlan_ManagerRule rule in hseRuleList)
{
Model.Manager_Month_PlanC plan = new Model.Manager_Month_PlanC
{
PlanId = rule.ManagerRuleId,
PlanName = rule.ManageRuleName
};
List<Model.Sys_User> users = (from x in Funs.DB.Sys_User
join y in Funs.DB.Sys_FlowOperate
on x.UserId equals y.OperaterId
join z in Funs.DB.Project_ProjectUser
on y.OperaterId equals z.UserId
where (z.RoleId.Contains(BLL.Const.HSSEEngineer) || z.RoleId.Contains(BLL.Const.HSSEManager)) && y.MenuId == BLL.Const.ActionPlan_ManagerRuleMenuId && y.DataId == rule.ManagerRuleId
select x).Distinct().ToList();
if (users.Count() > 0)
{
string names = string.Empty;
foreach (var user in users)
{
names += user.UserName + ",";
}
if (!string.IsNullOrEmpty(names))
{
names = names.Substring(0, names.LastIndexOf(","));
}
plan.CompileMan = names;
}
if (rule.CompileDate != null)
{
plan.CompileDate = string.Format("{0:yyyy-MM-dd}", rule.CompileDate);
}
plans.Add(plan);
}
}
this.gvMonthPlan.DataSource = plans;
this.gvMonthPlan.DataBind();
}
#endregion
/// <summary>
/// 增加本月文件、方案修编情况说明
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNewMonthPlan_Click(object sender, EventArgs e)
{
jerqueSaveMonthPlanList();
Model.Manager_Month_PlanC monthPlanSort = new Model.Manager_Month_PlanC
#region
decimal? sProjectType1 = 0, sProjectType2 = 0, sProjectType3 = 0, sProjectType4 = 0, sProjectType5 = 0, sProjectType6 = 0;
decimal? tProjectType1 = 0;
List<Model.CostGoods_PayRegistration> payRegistrationsPro = BLL.PayRegistrationService.GetPayRegistrationByPayDate(projectStartTime, endTime, this.ProjectId, BLL.Const.UnitId_CWCEC);
if (payRegistrationsPro != null)
{
PlanId = SQLHelper.GetNewID(typeof(Model.Manager_Month_PlanC))
foreach (var item in payRegistrationsPro)
{
sProjectType1 += item.SMonthType1_1 + item.SMonthType1_2 + item.SMonthType1_3 + item.SMonthType1_4 + item.SMonthType1_5 + item.SMonthType1_6 + item.SMonthType1_7 + item.SMonthType1_8 + item.SMonthType1_9 + item.SMonthType1_10 + item.SMonthType1_11 + item.SMonthType1_12 + item.SMonthType1_13 + item.SMonthType1_14 + item.SMonthType1_15 + item.SMonthType1_16;
sProjectType2 += item.SMonthType2_1 + item.SMonthType2_2 + item.SMonthType2_3 + item.SMonthType2_4;
sProjectType3 += item.SMonthType3_1 + item.SMonthType3_2 + item.SMonthType3_3 + item.SMonthType3_4 + item.SMonthType3_5 + item.SMonthType3_6;
sProjectType4 += item.SMonthType4_1 + item.SMonthType4_2 + item.SMonthType4_3 + item.SMonthType4_4 + item.SMonthType4_5 + item.SMonthType4_6 + item.SMonthType4_7 + item.SMonthType4_8 + item.SMonthType4_9 + item.SMonthType4_10 + item.SMonthType4_11 + item.SMonthType4_12 + item.SMonthType4_13 + item.SMonthType4_14 + item.SMonthType4_15 + item.SMonthType4_16 + item.SMonthType4_17 + item.SMonthType4_18 + item.SMonthType4_19 + item.SMonthType4_20 + item.SMonthType4_21 + item.SMonthType4_22 + item.SMonthType4_23 + item.SMonthType4_24 + item.SMonthType4_25 + item.SMonthType4_26 + item.SMonthType4_27 + item.SMonthType4_28 + item.SMonthType4_29 + item.SMonthType4_30 + item.SMonthType4_31 + item.SMonthType4_32 + item.SMonthType4_33 + item.SMonthType4_34 + item.SMonthType4_35 + item.SMonthType4_35 + item.SMonthType4_36 + item.SMonthType4_37 + item.SMonthType4_38 + item.SMonthType4_39 + item.SMonthType4_40;
sProjectType5 += item.SMonthType5_1 + item.SMonthType5_2 + item.SMonthType5_3 + item.SMonthType5_4 + item.SMonthType5_5 + item.SMonthType5_6;
sProjectType6 += item.SMonthType6_1 + item.SMonthType6_2 + item.SMonthType6_3;
tProjectType1 += item.TMonthType1_1 + item.TMonthType1_2 + item.TMonthType1_3 + item.TMonthType1_4 + item.TMonthType1_5 + item.TMonthType1_6 + item.TMonthType1_7 + item.TMonthType1_8 + item.TMonthType1_9 + item.TMonthType1_10 + item.TMonthType1_11;
}
}
#endregion
#region
decimal? sConMonthType1 = 0, sConMonthType2 = 0, sConMonthType3 = 0, sConMonthType4 = 0, sConMonthType5 = 0, sConMonthType6 = 0;
decimal? tConMonthType1 = 0;
List<Model.CostGoods_PayRegistration> payRegistrationsConMonth = BLL.PayRegistrationService.GetConPayRegistrationByPayDate(startTime, endTime, this.ProjectId);
if (payRegistrationsConMonth != null)
{
foreach (var item in payRegistrationsConMonth)
{
sConMonthType1 += item.SMonthType1_1 + item.SMonthType1_2 + item.SMonthType1_3 + item.SMonthType1_4 + item.SMonthType1_5 + item.SMonthType1_6 + item.SMonthType1_7 + item.SMonthType1_8 + item.SMonthType1_9 + item.SMonthType1_10 + item.SMonthType1_11 + item.SMonthType1_12 + item.SMonthType1_13 + item.SMonthType1_14 + item.SMonthType1_15 + item.SMonthType1_16;
sConMonthType2 += item.SMonthType2_1 + item.SMonthType2_2 + item.SMonthType2_3 + item.SMonthType2_4;
sConMonthType3 += item.SMonthType3_1 + item.SMonthType3_2 + item.SMonthType3_3 + item.SMonthType3_4 + item.SMonthType3_5 + item.SMonthType3_6;
sConMonthType4 += item.SMonthType4_1 + item.SMonthType4_2 + item.SMonthType4_3 + item.SMonthType4_4 + item.SMonthType4_5 + item.SMonthType4_6 + item.SMonthType4_7 + item.SMonthType4_8 + item.SMonthType4_9 + item.SMonthType4_10 + item.SMonthType4_11 + item.SMonthType4_12 + item.SMonthType4_13 + item.SMonthType4_14 + item.SMonthType4_15 + item.SMonthType4_16 + item.SMonthType4_17 + item.SMonthType4_18 + item.SMonthType4_19 + item.SMonthType4_20 + item.SMonthType4_21 + item.SMonthType4_22 + item.SMonthType4_23 + item.SMonthType4_24 + item.SMonthType4_25 + item.SMonthType4_26 + item.SMonthType4_27 + item.SMonthType4_28 + item.SMonthType4_29 + item.SMonthType4_30 + item.SMonthType4_31 + item.SMonthType4_32 + item.SMonthType4_33 + item.SMonthType4_34 + item.SMonthType4_35 + item.SMonthType4_35 + item.SMonthType4_36 + item.SMonthType4_37 + item.SMonthType4_38 + item.SMonthType4_39 + item.SMonthType4_40;
sConMonthType5 += item.SMonthType5_1 + item.SMonthType5_2 + item.SMonthType5_3 + item.SMonthType5_4 + item.SMonthType5_5 + item.SMonthType5_6;
sConMonthType6 += item.SMonthType6_1 + item.SMonthType6_2 + item.SMonthType6_3;
tConMonthType1 += item.TMonthType1_1 + item.TMonthType1_2 + item.TMonthType1_3 + item.TMonthType1_4 + item.TMonthType1_5 + item.TMonthType1_6 + item.TMonthType1_7 + item.TMonthType1_8 + item.TMonthType1_9 + item.TMonthType1_10 + item.TMonthType1_11;
}
}
#endregion
#region
decimal? sConProjectType1 = 0, sConProjectType2 = 0, sConProjectType3 = 0, sConProjectType4 = 0, sConProjectType5 = 0, sConProjectType6 = 0;
decimal? tConProjectType1 = 0;
List<Model.CostGoods_PayRegistration> payRegistrationsConPro = BLL.PayRegistrationService.GetConPayRegistrationByPayDate(projectStartTime, endTime, this.ProjectId);
if (payRegistrationsConPro != null)
{
foreach (var item in payRegistrationsConPro)
{
sConProjectType1 += item.SMonthType1_1 + item.SMonthType1_2 + item.SMonthType1_3 + item.SMonthType1_4 + item.SMonthType1_5 + item.SMonthType1_6 + item.SMonthType1_7 + item.SMonthType1_8 + item.SMonthType1_9 + item.SMonthType1_10 + item.SMonthType1_11 + item.SMonthType1_12 + item.SMonthType1_13 + item.SMonthType1_14 + item.SMonthType1_15 + item.SMonthType1_16;
sConProjectType2 += item.SMonthType2_1 + item.SMonthType2_2 + item.SMonthType2_3 + item.SMonthType2_4;
sConProjectType3 += item.SMonthType3_1 + item.SMonthType3_2 + item.SMonthType3_3 + item.SMonthType3_4 + item.SMonthType3_5 + item.SMonthType3_6;
sConProjectType4 += item.SMonthType4_1 + item.SMonthType4_2 + item.SMonthType4_3 + item.SMonthType4_4 + item.SMonthType4_5 + item.SMonthType4_6 + item.SMonthType4_7 + item.SMonthType4_8 + item.SMonthType4_9 + item.SMonthType4_10 + item.SMonthType4_11 + item.SMonthType4_12 + item.SMonthType4_13 + item.SMonthType4_14 + item.SMonthType4_15 + item.SMonthType4_16 + item.SMonthType4_17 + item.SMonthType4_18 + item.SMonthType4_19 + item.SMonthType4_20 + item.SMonthType4_21 + item.SMonthType4_22 + item.SMonthType4_23 + item.SMonthType4_24 + item.SMonthType4_25 + item.SMonthType4_26 + item.SMonthType4_27 + item.SMonthType4_28 + item.SMonthType4_29 + item.SMonthType4_30 + item.SMonthType4_31 + item.SMonthType4_32 + item.SMonthType4_33 + item.SMonthType4_34 + item.SMonthType4_35 + item.SMonthType4_35 + item.SMonthType4_36 + item.SMonthType4_37 + item.SMonthType4_38 + item.SMonthType4_39 + item.SMonthType4_40;
sConProjectType5 += item.SMonthType5_1 + item.SMonthType5_2 + item.SMonthType5_3 + item.SMonthType5_4 + item.SMonthType5_5 + item.SMonthType5_6;
sConProjectType6 += item.SMonthType6_1 + item.SMonthType6_2 + item.SMonthType6_3;
tConProjectType1 += item.TMonthType1_1 + item.TMonthType1_2 + item.TMonthType1_3 + item.TMonthType1_4 + item.TMonthType1_5 + item.TMonthType1_6 + item.TMonthType1_7 + item.TMonthType1_8 + item.TMonthType1_9 + item.TMonthType1_10 + item.TMonthType1_11;
}
}
#endregion
int i = 0;
Model.Manager_Month_FiveExpenseC 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//施工分包商(项目累计)
};
plans.Add(monthPlanSort);
this.gvMonthPlan.DataSource = plans;
this.gvMonthPlan.DataBind();
}
fiveExpenses.Add(fiveExpense1);
i++;
/// <summary>
/// 检查并保存其他HSE管理活动集合
/// </summary>
private void jerqueSaveMonthPlanList()
{
plans.Clear();
JArray mergedData = gvMonthPlan.GetMergedData();
foreach (JObject mergedRow in mergedData)
Model.Manager_Month_FiveExpenseC fiveExpense2 = new Model.Manager_Month_FiveExpenseC
{
string status = mergedRow.Value<string>("status");
JObject values = mergedRow.Value<JObject>("values");
int i = mergedRow.Value<int>("index");
Model.Manager_Month_PlanC monthPlanSort = new Model.Manager_Month_PlanC
{
PlanId = this.gvMonthPlan.Rows[i].DataKeys[0].ToString(),
SortIndex = i,
PlanName = values.Value<string>("PlanName").ToString(),
CompileMan = values.Value<string>("CompileMan").ToString(),
CompileDate = values.Value<string>("CompileDate").ToString()
};
plans.Add(monthPlanSort);
}
}
protected void gvMonthPlan_RowCommand(object sender, GridCommandEventArgs e)
{
jerqueSaveMonthPlanList();
string rowID = this.gvMonthPlan.DataKeys[e.RowIndex][0].ToString();
if (e.CommandName == "Delete")
{
foreach (var item in plans)
{
if (item.PlanId == rowID)
{
plans.Remove(item);
break;
}
}
gvMonthPlan.DataSource = plans;
gvMonthPlan.DataBind();
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
}
}
/// <summary>
/// 审查记录修编情况修编、审核
/// </summary>
private void GetReviewRecordSort()
{
//施工方案
List<Model.Solution_ConstructSolution> constructSolution = BLL.ConstructSolutionService.GetConstructSolutionListByDate(this.ProjectId, startTime, endTime);
if (constructSolution.Count > 0)
{
foreach (Model.Solution_ConstructSolution item in constructSolution)
{
Model.Manager_Month_ReviewRecordC reviewRecord = new Model.Manager_Month_ReviewRecordC
{
ReviewRecordId = SQLHelper.GetNewID(typeof(Model.Manager_Month_ReviewRecordC)),
ReviewRecordName = item.ConstructSolutionName
};
List<Model.Sys_User> users = (from x in Funs.DB.Sys_User
join y in Funs.DB.Sys_FlowOperate
on x.UserId equals y.OperaterId
join z in Funs.DB.Project_ProjectUser
on y.OperaterId equals z.UserId
where (z.RoleId.Contains(BLL.Const.HSSEEngineer) || z.RoleId.Contains(BLL.Const.HSSEManager)) && y.MenuId == BLL.Const.ProjectConstructSolutionMenuId && y.DataId == item.ConstructSolutionId
select x).Distinct().ToList();
if (users.Count() > 0)
{
string names = string.Empty;
foreach (var user in users)
{
names += user.UserName + ",";
}
if (!string.IsNullOrEmpty(names))
{
names = names.Substring(0, names.LastIndexOf(","));
}
reviewRecord.ReviewMan = names;
}
if (item.CompileDate != null)
{
reviewRecord.ReviewDate = string.Format("{0:yyyy-MM-dd}", item.CompileDate);
}
reviewRecords.Add(reviewRecord);
}
}
//分包商审核记录
List<Model.QualityAudit_SubUnitQualityAuditDetail> subUnitDetails = BLL.SubUnitQualityAuditDetailService.GetListByDate(this.ProjectId, startTime, endTime);
if (subUnitDetails.Count > 0)
{
foreach (Model.QualityAudit_SubUnitQualityAuditDetail item in subUnitDetails)
{
Model.Manager_Month_ReviewRecordC reviewRecord = new Model.Manager_Month_ReviewRecordC
{
ReviewRecordId = SQLHelper.GetNewID(typeof(Model.Manager_Month_ReviewRecordC)),
ReviewRecordName = item.AuditContent
};
Model.Sys_User user = BLL.UserService.GetUserByUserId(item.AuditMan);
if (user != null)
{
reviewRecord.ReviewMan = user.UserName;
}
if (item.AuditDate != null)
{
reviewRecord.ReviewDate = string.Format("{0:yyyy-MM-dd}", item.AuditDate);
}
reviewRecords.Add(reviewRecord);
}
}
//特种设备审核记录
List<Model.QualityAudit_EquipmentQualityAuditDetail> equipmentDetails = BLL.EquipmentQualityAuditDetailService.GetListByDate(this.ProjectId, startTime, endTime);
if (equipmentDetails.Count > 0)
{
foreach (Model.QualityAudit_EquipmentQualityAuditDetail item in equipmentDetails)
{
Model.Manager_Month_ReviewRecordC reviewRecord = new Model.Manager_Month_ReviewRecordC
{
ReviewRecordId = SQLHelper.GetNewID(typeof(Model.Manager_Month_ReviewRecordC)),
ReviewRecordName = item.AuditContent
};
Model.Sys_User user = BLL.UserService.GetUserByUserId(item.AuditMan);
if (user != null)
{
reviewRecord.ReviewMan = user.UserName;
}
if (item.AuditDate != null)
{
reviewRecord.ReviewDate = string.Format("{0:yyyy-MM-dd}", item.AuditDate);
}
reviewRecords.Add(reviewRecord);
}
}
//特岗人员资质
List<Model.QualityAudit_PersonQuality> personDetails = BLL.PersonQualityService.GetListByDate(this.ProjectId, startTime, endTime);
if (personDetails.Count > 0)
{
foreach (Model.QualityAudit_PersonQuality item in personDetails)
{
Model.Manager_Month_ReviewRecordC reviewRecord = new Model.Manager_Month_ReviewRecordC
{
ReviewRecordId = SQLHelper.GetNewID(typeof(Model.Manager_Month_ReviewRecordC))
};
string personName = string.Empty;
Model.SitePerson_Person person = BLL.PersonService.GetPersonById(item.PersonId);
if (person != null)
{
personName = person.PersonName;
}
reviewRecord.ReviewRecordName = personName + "(" + item.CertificateName + ")";
reviewRecord.ReviewMan = item.ApprovalPerson;
if (item.AuditDate != null)
{
reviewRecord.ReviewDate = string.Format("{0:yyyy-MM-dd}", item.AuditDate);
}
reviewRecords.Add(reviewRecord);
}
}
//一般机具资质
List<Model.QualityAudit_GeneralEquipmentQuality> generalEquipmentDetails = BLL.GeneralEquipmentQualityService.GetListByDate(this.ProjectId, startTime, endTime);
if (generalEquipmentDetails.Count > 0)
{
foreach (Model.QualityAudit_GeneralEquipmentQuality item in generalEquipmentDetails)
{
Model.Manager_Month_ReviewRecordC reviewRecord = new Model.Manager_Month_ReviewRecordC
{
ReviewRecordId = SQLHelper.GetNewID(typeof(Model.Manager_Month_ReviewRecordC))
};
string generalEquipmentName = string.Empty;
Model.Base_SpecialEquipment specialEquipment = BLL.SpecialEquipmentService.GetSpecialEquipmentById(item.SpecialEquipmentId);
if (specialEquipment != null)
{
generalEquipmentName = specialEquipment.SpecialEquipmentName;
}
reviewRecord.ReviewRecordName = generalEquipmentName + "(" + item.EquipmentCount.ToString() + ")";
Model.Sys_User user = BLL.UserService.GetUserByUserId(item.CompileMan);
if (user != null)
{
reviewRecord.ReviewMan = user.UserName;
}
if (item.InDate != null)
{
reviewRecord.ReviewDate = string.Format("{0:yyyy-MM-dd}", item.InDate);
}
reviewRecords.Add(reviewRecord);
}
}
this.gvReviewRecord.DataSource = reviewRecords;
this.gvReviewRecord.DataBind();
}
/// <summary>
/// 增加本月文件、方案修编情况说明
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNewReviewRecord_Click(object sender, EventArgs e)
{
jerqueSaveReviewRecordList();
Model.Manager_Month_ReviewRecordC reviewRecordSort = new Model.Manager_Month_ReviewRecordC
{
ReviewRecordId = SQLHelper.GetNewID(typeof(Model.Manager_Month_ReviewRecordC))
FiveExpenseId = SQLHelper.GetNewID(typeof(Model.Manager_Month_FiveExpenseC)),
SortIndex = i,
InvestmentProject = "安全技术",
PlanCostMonth = sMonthType2,//五环工程(本月)
PlanCostYear = sProjectType2, //五环工程(项目累计)
ActualCostMonth = sConMonthType2,//施工分包商(本月)
ActualCostYear = sConProjectType2//施工分包商(项目累计)
};
reviewRecords.Add(reviewRecordSort);
this.gvReviewRecord.DataSource = reviewRecords;
this.gvReviewRecord.DataBind();
}
fiveExpenses.Add(fiveExpense2);
i++;
Model.Manager_Month_FiveExpenseC fiveExpense3 = 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(fiveExpense3);
i++;
Model.Manager_Month_FiveExpenseC fiveExpense4 = 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(fiveExpense4);
i++;
Model.Manager_Month_FiveExpenseC fiveExpense5 = 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(fiveExpense5);
i++;
Model.Manager_Month_FiveExpenseC fiveExpense6 = 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(fiveExpense6);
i++;
Model.Manager_Month_FiveExpenseC fiveExpense7 = new Model.Manager_Month_FiveExpenseC
{
FiveExpenseId = SQLHelper.GetNewID(typeof(Model.Manager_Month_FiveExpenseC)),
SortIndex = i,
InvestmentProject = "文明施工环境保护",
PlanCostMonth = tMonthType1,//五环工程(本月)
PlanCostYear = tMonthType1, //五环工程(项目累计)
ActualCostMonth = tConMonthType1,//施工分包商(本月)
ActualCostYear = tConProjectType1//施工分包商(项目累计)
};
fiveExpenses.Add(fiveExpense7);
this.gvFiveExpenseC.DataSource = fiveExpenses;
this.gvFiveExpenseC.DataBind();
OutputSummaryData();
}
/// <summary>
/// 检查并保存其他HSE管理活动集合
/// 求和
/// </summary>
private void jerqueSaveReviewRecordList()
private void OutputSummaryData()
{
reviewRecords.Clear();
JArray mergedData = gvReviewRecord.GetMergedData();
foreach (JObject mergedRow in mergedData)
JObject summary = new JObject();
decimal TotalPlanCostMonth = 0, TotalPlanCostYear = 0, TotalActualCostMonth = 0, TotalActualCostYear = 0;
foreach (JObject mergedRow in gvFiveExpenseC.GetMergedData())
{
string status = mergedRow.Value<string>("status");
JObject values = mergedRow.Value<JObject>("values");
int i = mergedRow.Value<int>("index");
Model.Manager_Month_ReviewRecordC reviewRecordSort = new Model.Manager_Month_ReviewRecordC
if (!string.IsNullOrEmpty(values["PlanCostMonth"].ToString()))
{
ReviewRecordId = this.gvReviewRecord.Rows[i].DataKeys[0].ToString(),
SortIndex = i,
ReviewRecordName = values.Value<string>("ReviewRecordName").ToString(),
ReviewMan = values.Value<string>("ReviewMan").ToString(),
ReviewDate = values.Value<string>("ReviewDate").ToString()
};
reviewRecords.Add(reviewRecordSort);
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;
}
protected void gvReviewRecord_RowCommand(object sender, GridCommandEventArgs e)
#endregion
#region HSE费用支付统计
/// <summary>
/// 绑定数据
/// </summary>
private void GetSubExpenseList()
{
jerqueSaveReviewRecordList();
string rowID = this.gvReviewRecord.DataKeys[e.RowIndex][0].ToString();
if (e.CommandName == "Delete")
var units = from x in Funs.DB.Project_ProjectUnit
where x.ProjectId == this.ProjectId && x.UnitType == "2"
orderby x.UnitType
select x;
if (units.Count() > 0)
{
foreach (var item in reviewRecords)
foreach (Model.Project_ProjectUnit u in units)
{
if (item.ReviewRecordId == rowID)
Model.Manager_Month_SubExpenseC subExpense = new Model.Manager_Month_SubExpenseC
{
reviewRecords.Remove(item);
break;
}
SubExpenseId = SQLHelper.GetNewID(typeof(Model.Manager_Month_SubExpenseC)),
SubUnit =BLL.UnitService.GetUnitNameByUnitId(u.UnitId),
ContractAmount = BLL.SubPayRegistrationService.GetSubPaySMonthTypeByUnitId(u.UnitId, startTime,endTime),
MonthApprovalAmount = BLL.SubPayRegistrationService.GetSubPayRegistrationByUnitId(u.UnitId, startTime, endTime),
ProjectApprovalAmount = BLL.SubPayRegistrationService.GetSubPayRegistrationByUnitId(u.UnitId, projectStartTime, endTime),
};
subExpenses.Add(subExpense);
}
gvReviewRecord.DataSource = reviewRecords;
gvReviewRecord.DataBind();
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
}
this.gvSubExpenseC.DataSource = subExpenses;
this.gvSubExpenseC.DataBind();
OutputSubSummaryData();
}
/// <summary>
/// 求和
/// </summary>
private void OutputSubSummaryData()
{
JObject summary = new JObject();
decimal TotalContractAmount = 0, TotalMonthApprovalAmount = 0, TotalProjectApprovalAmount = 0;
foreach (JObject mergedRow in gvSubExpenseC.GetMergedData())
{
JObject values = mergedRow.Value<JObject>("values");
if (!string.IsNullOrEmpty(values["ContractAmount"].ToString()))
{
TotalContractAmount += values.Value<decimal>("ContractAmount");
}
if (!string.IsNullOrEmpty(values["MonthApprovalAmount"].ToString()))
{
TotalMonthApprovalAmount += values.Value<decimal>("MonthApprovalAmount");
}
if (!string.IsNullOrEmpty(values["ProjectApprovalAmount"].ToString()))
{
TotalProjectApprovalAmount += values.Value<decimal>("ProjectApprovalAmount");
}
}
summary.Add("SubUnit", "合计");
summary.Add("ContractAmount", TotalContractAmount.ToString("F2"));
summary.Add("MonthApprovalAmount", TotalMonthApprovalAmount.ToString("F2"));
summary.Add("ProjectApprovalAmount", TotalProjectApprovalAmount.ToString("F2"));
gvSubExpenseC.SummaryData = summary;
}
#endregion
@@ -510,8 +414,8 @@ namespace FineUIPro.Web.HSSE.Manager
if (oldMonthReport != null)
{
BLL.MonthReportCService.UpdateMonthReport(oldMonthReport);
OperatePlanSort(MonthReportId);
OperateReviewRecordSort(MonthReportId);
OperateFiveExpenseSort(oldMonthReport.MonthReportId);
OperateSubExpenseSort(oldMonthReport.MonthReportId);
BLL.LogService.AddSys_Log(this.CurrUser, oldMonthReport.MonthReportCode, oldMonthReport.MonthReportId, BLL.Const.ProjectManagerMonthCMenuId, BLL.Const.BtnModify);
}
else
@@ -520,49 +424,105 @@ namespace FineUIPro.Web.HSSE.Manager
string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_MonthReportC));
monthReport.MonthReportId = newKeyID;
monthReport.ProjectId = this.CurrUser.LoginProjectId;
this.MonthReportId = newKeyID;
this.newKeyID = newKeyID;
monthReport.MonthReportCode = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectManagerMonthCMenuId, this.ProjectId, this.CurrUser.UnitId);
monthReport.Months = Funs.GetNewDateTime(Request.Params["months"]);
monthReport.ReportMan = this.CurrUser.UserId;
monthReport.MonthReportDate = DateTime.Now;
BLL.MonthReportCService.AddMonthReport(monthReport);
OperatePlanSort(MonthReportId);
OperateReviewRecordSort(MonthReportId);
OperateFiveExpenseSort(newKeyID);
OperateSubExpenseSort(newKeyID);
BLL.LogService.AddSys_Log(this.CurrUser, monthReport.MonthReportCode, monthReport.MonthReportId, BLL.Const.ProjectManagerMonthCMenuId, BLL.Const.BtnAdd);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
}
#region HSE费用投入统计
/// <summary>
/// 5.1.2 本月文件、方案修编情况说明
/// 本月项目HSE费用投入统计
/// </summary>
/// <param name="monthReportId"></param>
private void OperatePlanSort(string monthReportId)
private void OperateFiveExpenseSort(string monthReportId)
{
BLL.PlanCService.DeletePlanByMonthReportId(monthReportId);
jerqueSaveMonthPlanList();
foreach (Model.Manager_Month_PlanC plan in plans)
BLL.FiveExpenseCService.DeleteFiveExpenseByMonthReportId(monthReportId);
jerqueSaveFiveExpenseList();
foreach (Model.Manager_Month_FiveExpenseC fiveExpendse in fiveExpenses)
{
plan.MonthReportId = monthReportId;
BLL.PlanCService.AddPlan(plan);
fiveExpendse.MonthReportId = monthReportId;
BLL.FiveExpenseCService.AddFiveExpense(fiveExpendse);
}
}
/// <summary>
/// 5.2.2 详细审查记录
/// 保存本月项目HSE费用投入统计数据
/// </summary>
/// <param name="monthReportId"></param>
private void OperateReviewRecordSort(string monthReportId)
private void jerqueSaveFiveExpenseList()
{
BLL.ReviewRecordCService.DeleteReviewRecordByMonthReportId(monthReportId);
jerqueSaveReviewRecordList();
foreach (Model.Manager_Month_ReviewRecordC reviewRecord in reviewRecords)
fiveExpenses.Clear();
JArray mergedData = gvFiveExpenseC.GetMergedData();
foreach (JObject mergedRow in mergedData)
{
reviewRecord.MonthReportId = monthReportId;
BLL.ReviewRecordCService.AddReviewRecord(reviewRecord);
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 HSE费用支付统计
/// <summary>
/// 本月项目分包商HSE费用支付统计
/// </summary>
/// <param name="monthReportId"></param>
private void OperateSubExpenseSort(string monthReportId)
{
BLL.SubExpenseCService.DeleteSubExpenseByMonthReportId(monthReportId);
jerqueSaveSubExpenseList();
foreach (Model.Manager_Month_SubExpenseC subExpendse in subExpenses)
{
subExpendse.MonthReportId = monthReportId;
BLL.SubExpenseCService.AddSubExpense(subExpendse);
}
}
/// <summary>
/// 保存本月项目分包商HSE费用支付统计数据
/// </summary>
private void jerqueSaveSubExpenseList()
{
subExpenses.Clear();
JArray mergedData = gvSubExpenseC.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_SubExpenseC trainSort = new Model.Manager_Month_SubExpenseC
{
SubExpenseId = this.gvSubExpenseC.Rows[i].DataKeys[0].ToString(),
SortIndex = i,
SubUnit = values.Value<string>("SubUnit").ToString(),
ContractAmount = Funs.GetNewDecimal(values.Value<string>("ContractAmount").ToString()),
MonthApprovalAmount = Funs.GetNewDecimal(values.Value<string>("MonthApprovalAmount").ToString()),
ProjectApprovalAmount = Funs.GetNewDecimal(values.Value<string>("ProjectApprovalAmount").ToString())
};
subExpenses.Add(trainSort);
}
}
#endregion
#endregion
}
}