修改安全月报

This commit is contained in:
2024-09-03 17:22:58 +08:00
parent d21533d599
commit 89657b13df
9 changed files with 1257 additions and 195 deletions
@@ -580,7 +580,7 @@ namespace FineUIPro.Web.HSSE.Manager
bkmark = doc.Range.Bookmarks["createdate"];
if (bkmark != null)
{
//bkmark.Text = weekModel.CreateDate.ToString().Split(' ')[0].Replace('/', '.');
bkmark.Text = model.EndDate.ToString().Split(' ')[0].Replace('/', '.');
}
bkmark = doc.Range.Bookmarks["projectname"];
@@ -616,10 +616,10 @@ namespace FineUIPro.Web.HSSE.Manager
}
bkmark = doc.Range.Bookmarks["fromcode"];
//fromcode,项目号-RM-PQM-顺序号
//fromcode,项目号-RM-HSE-顺序号
if (bkmark != null)
{
bkmark.Text = pModel.ProjectCode + "-RM-PQM-" + model.MonthReportCode;
bkmark.Text = pModel.ProjectCode + "-RM-HSE-" + model.MonthReportCode;
}
#endregion
#region 1.
@@ -720,8 +720,15 @@ namespace FineUIPro.Web.HSSE.Manager
//创建行
Row row = new Row(doc);
row.Cells.Add(CreateCell(ConvertUnitName(item.UnitId), doc, table.Rows[1].Cells[0].CellFormat.Width, "", "", "unit"));
row.Cells.Add(CreateCell(item.SumPersonNum.ToString(), doc, table.Rows[1].Cells[1].CellFormat.Width));
row.Cells.Add(CreateCell(item.SumOutPersonNum.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
if (item.UnitId == Const.UnitId_CWCEC)
{
row.Cells.Add(CreateCell(item.SumPersonNum.ToString(), doc, table.Rows[1].Cells[1].CellFormat.Width));
row.Cells.Add(CreateCell(item.SumOutPersonNum.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
}
else {
row.Cells.Add(CreateCell(item.SumPersonNum.ToString(), doc, table.Rows[1].Cells[1].CellFormat.Width+ table.Rows[1].Cells[2].CellFormat.Width));
}
row.Cells.Add(CreateCell(item.HSEPersonNum.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.ContractRange.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
row.Cells.Add(CreateCell(item.Remark.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
@@ -735,8 +742,10 @@ namespace FineUIPro.Web.HSSE.Manager
//创建合计
Row rowhj = new Row(doc);
rowhj.Cells.Add(CreateCell("合计", doc, table.Rows[1].Cells[0].CellFormat.Width, "", "", "unit"));
rowhj.Cells.Add(CreateCell((from x in sorts select x.SumPersonNum ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[1].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in sorts select x.SumOutPersonNum ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
rowhj.Cells.Add(CreateCell(((from x in sorts select x.SumPersonNum ?? 0).Sum()
+ (from x in sorts select x.SumOutPersonNum ?? 0).Sum()).ToString(), doc, table.Rows[1].Cells[1].CellFormat.Width
+table.Rows[1].Cells[2].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in sorts select x.HSEPersonNum ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
rowhj.Cells.Add(CreateCell("", doc, table.Rows[1].Cells[4].CellFormat.Width));
rowhj.Cells.Add(CreateCell("", doc, table.Rows[1].Cells[5].CellFormat.Width));
@@ -907,6 +916,9 @@ namespace FineUIPro.Web.HSSE.Manager
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
whileIndex += 1;
}
#endregion
#region 4.3
@@ -917,7 +929,7 @@ namespace FineUIPro.Web.HSSE.Manager
where x.MonthReportId == Id && y.ProjectId == this.ProjectId
orderby y.UnitType
select x).ToList();
if (HiddenDangersorts.Count>0)
if (HiddenDangersorts.Count > 0)
{
isYm = true;
whileIndex += 1;
@@ -952,7 +964,7 @@ namespace FineUIPro.Web.HSSE.Manager
//合计
rowhj = new Row(doc);
rowhj.Cells.Add(CreateCell("本月隐患总数", doc, table.FirstRow.Cells[0].CellFormat.Width+table.FirstRow.Cells[1].CellFormat.Width));
rowhj.Cells.Add(CreateCell("本月隐患总数", doc, table.FirstRow.Cells[0].CellFormat.Width + table.FirstRow.Cells[1].CellFormat.Width));
rowhj.Cells.Add(CreateCell(model.MonthHdangerCount.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
rowhj.Cells.Add(CreateCell("年度隐患总数", doc, table.FirstRow.Cells[3].CellFormat.Width));
rowhj.Cells.Add(CreateCell(model.YearHdangerCount.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
@@ -962,10 +974,911 @@ namespace FineUIPro.Web.HSSE.Manager
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
whileIndex += 1;
}
#endregion
#region 4.4
var mpModel = db.Manager_ProjectAssignment.FirstOrDefault(x => x.MonthReportId == Id);
whileIndex += 1;
if (mpModel!=null)
{
bkmark = doc.Range.Bookmarks["nbFireWorkCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.FireWorkCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbBreakGroundCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.BreakGroundCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbLimitedSpaceCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.LimitedSpaceCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbElectricityCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.ElectricityCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbHeightWorkCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.HeightWorkCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbRadialWork"];
if (bkmark != null)
{
bkmark.Text = mpModel.RadialWork.ToString();
}
bkmark = doc.Range.Bookmarks["nbLiftingWorkCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.LiftingWorkCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbNightWork"];
if (bkmark != null)
{
bkmark.Text = mpModel.NightWork.ToString();
}
bkmark = doc.Range.Bookmarks["nbMonthCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.MonthCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbYearCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.YearCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbProCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.ProCount.ToString();
}
}
#endregion
#region 4.5
bkmark = doc.Range.Bookmarks["MonthExpertNoCount"];
if (bkmark != null)
{
bkmark.Text =model.MonthExpertNoCount.ToString();
}
bkmark = doc.Range.Bookmarks["MonthExpertCount"];
if (bkmark != null)
{
bkmark.Text = model.MonthExpertCount.ToString();
}
whileIndex += 1;
#endregion
#region 4.6.1
var emergencyPlanList = db.Manager_EmergencyPlan.Where(x => x.MonthReportId == Id).OrderBy(x => x.SortIndex).ToList();
if (emergencyPlanList.Count > 0)
{
isYm = true;
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
//跳过页眉的表头
while (isYm)
{
if (table.Range.Text.Substring(0, 2) != "序号")
{
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
}
else
{
isYm = false;
}
}
numberIndex = 1;
foreach (var item in emergencyPlanList)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.CaType, doc, table.FirstRow.Cells[1].CellFormat.Width));
row.Cells.Add(CreateCell(item.MonthCount.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.YearCount.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.ProCount.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
whileIndex += 1;
}
#endregion
#region 4.6.2
var drillRecordList = db.Manager_DrillRecordList.Where(x => x.MonthReportId == Id).OrderBy(x => x.Ddate).ToList();
isYm = true;
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
//跳过页眉的表头
while (isYm)
{
if (table.Range.Text.Substring(0, 2) != "序号")
{
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
}
else
{
isYm = false;
}
}
if (drillRecordList.Count > 0)
{
numberIndex = 1;
foreach (var item in drillRecordList)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.Dname, doc, table.FirstRow.Cells[1].CellFormat.Width));
row.Cells.Add(CreateCell(Convert.ToDateTime(item.Ddate).ToString("yyyy-MM-dd"), doc, table.FirstRow.Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.DrillRecordTypeName.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.PersonNum.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
row.Cells.Add(CreateCell(item.DrillCost.ToString(), doc, table.FirstRow.Cells[5].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
numberIndex = 1;
Row row = new Row(doc);
row.Cells.Add(CreateCell("暂无数据", doc, table.FirstRow.Cells[0].CellFormat.Width
+ table.FirstRow.Cells[1].CellFormat.Width+ table.FirstRow.Cells[2].CellFormat.Width
+ table.FirstRow.Cells[3].CellFormat.Width
+ table.FirstRow.Cells[4].CellFormat.Width
+ table.FirstRow.Cells[5].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#region 4.6.3
bkmark = doc.Range.Bookmarks["EmergencyManagementWorkDef"];
if (bkmark != null)
{
bkmark.Text = model.EmergencyManagementWorkDef.ToString();
}
#endregion
#region 4.7 HSE奖励与处罚
whileIndex += 1;
var rewardAndPunishSortCs = db.Manager_RewardAndPunishSortC.FirstOrDefault(x=>x.MonthReportId==Id);
if (rewardAndPunishSortCs!=null)
{
bkmark = doc.Range.Bookmarks["RewardNum"];
if (bkmark != null)
{
bkmark.Text = rewardAndPunishSortCs.RewardNum.ToString();
}
bkmark = doc.Range.Bookmarks["RewardMoney"];
if (bkmark != null)
{
bkmark.Text = rewardAndPunishSortCs.RewardMoney.ToString();
}
bkmark = doc.Range.Bookmarks["ProjectRewardMoney"];
if (bkmark != null)
{
bkmark.Text = rewardAndPunishSortCs.ProjectRewardMoney.ToString();
}
bkmark = doc.Range.Bookmarks["PunishNum"];
if (bkmark != null)
{
bkmark.Text = rewardAndPunishSortCs.PunishNum.ToString();
}
bkmark = doc.Range.Bookmarks["PunishMoney"];
if (bkmark != null)
{
bkmark.Text = rewardAndPunishSortCs.PunishMoney.ToString();
}
bkmark = doc.Range.Bookmarks["ProjectPunishMoney"];
if (bkmark != null)
{
bkmark.Text = rewardAndPunishSortCs.ProjectPunishMoney.ToString();
}
}
#endregion
#region 4.8HSE现场其他管理情况
var otherManagements = BLL.OtherManagementCService.GetOtherManagementByMonthReportId(Id);
isYm = true;
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
//跳过页眉的表头
while (isYm)
{
if (table.Range.Text.Substring(0, 2) != "序号")
{
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
}
else
{
isYm = false;
}
}
if (otherManagements.Count > 0)
{
numberIndex = 1;
foreach (var item in otherManagements)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.ManagementDes, doc, table.FirstRow.Cells[1].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
numberIndex = 1;
Row row = new Row(doc);
row.Cells.Add(CreateCell("暂无数据", doc, table.FirstRow.Cells[0].CellFormat.Width
+ table.FirstRow.Cells[1].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#region 5.1 HSE费用投入统计
var fiveExpenses = BLL.FiveExpenseCService.GetFiveExpenseByMonthReportId(Id);
if (fiveExpenses.Count > 0)
{
isYm = true;
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
//跳过页眉的表头
while (isYm)
{
if (table.Range.Text.Substring(0, 2) != "序号")
{
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
}
else
{
isYm = false;
}
}
numberIndex = 2;
foreach (var item in fiveExpenses)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell((numberIndex - 1).ToString(), doc, table.Rows[1].Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.InvestmentProject, doc, table.Rows[1].Cells[1].CellFormat.Width, "", "", "unit"));
row.Cells.Add(CreateCell(item.PlanCostMonth.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.PlanCostYear.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.ActualCostMonth.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
row.Cells.Add(CreateCell(item.ActualCostYear.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
//求和
//创建合计
rowhj = new Row(doc);
rowhj.Cells.Add(CreateCell("合计", doc, (table.Rows[1].Cells[0].CellFormat.Width + table.Rows[1].Cells[1].CellFormat.Width)));
rowhj.Cells.Add(CreateCell((from x in fiveExpenses select x.PlanCostMonth ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in fiveExpenses select x.PlanCostYear ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in fiveExpenses select x.ActualCostMonth ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in fiveExpenses select x.ActualCostYear ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
table.Rows.Insert(numberIndex, rowhj);
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
whileIndex += 1;
}
#endregion
#region 6.1(1) HSE责任事故/
var attemptedModel = db.Manager_Attempted.FirstOrDefault(x => x.MonthReportId == Id);
if (attemptedModel != null)
{
bkmark = doc.Range.Bookmarks["WhMonthNum"];
if (bkmark != null)
{
bkmark.Text = attemptedModel.WhMonthNum.ToString();
}
bkmark = doc.Range.Bookmarks["WhYearNum"];
if (bkmark != null)
{
bkmark.Text = attemptedModel.WhYearNum.ToString();
}
bkmark = doc.Range.Bookmarks["FbsMonthNum"];
if (bkmark != null)
{
bkmark.Text = attemptedModel.FbsMonthNum.ToString();
}
bkmark = doc.Range.Bookmarks["FbsYearNum"];
if (bkmark != null)
{
bkmark.Text = attemptedModel.FbsYearNum.ToString();
}
bkmark = doc.Range.Bookmarks["ProNum"];
if (bkmark != null)
{
bkmark.Text = attemptedModel.ProNum.ToString();
}
whileIndex += 1;
}
#endregion
#region 6.1(2)
var injuryAccidents = BLL.InjuryAccidentCService.GetInjuryAccidentCByMonthReportId(Id);
if (injuryAccidents.Count > 0)
{
isYm = true;
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
//跳过页眉的表头
while (isYm)
{
if (table.Range.Text.Substring(0, 4) != " 事故")
{
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
}
else
{
isYm = false;
}
}
numberIndex = 4;
foreach (var item in injuryAccidents)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell(item.UnitName, doc, table.Rows[3].Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.FirstAidDressing.ToString(), doc, table.Rows[3].Cells[1].CellFormat.Width));
row.Cells.Add(CreateCell(item.MedicalTreatment.ToString(), doc, table.Rows[3].Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.WorkLimitation.ToString(), doc, table.Rows[3].Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.LossCount.ToString(), doc, table.Rows[3].Cells[4].CellFormat.Width));
row.Cells.Add(CreateCell(item.LossPerson.ToString(), doc, table.Rows[3].Cells[5].CellFormat.Width));
row.Cells.Add(CreateCell(item.LossWorkTime.ToString(), doc, table.Rows[3].Cells[6].CellFormat.Width));
row.Cells.Add(CreateCell(item.LossEconomy.ToString(), doc, table.Rows[3].Cells[7].CellFormat.Width));
row.Cells.Add(CreateCell(item.DeathCount.ToString(), doc, table.Rows[3].Cells[8].CellFormat.Width));
row.Cells.Add(CreateCell(item.DeathPerson.ToString(), doc, table.Rows[3].Cells[9].CellFormat.Width));
row.Cells.Add(CreateCell(item.DeathWorkTime.ToString(), doc, table.Rows[3].Cells[10].CellFormat.Width));
row.Cells.Add(CreateCell(item.DeathEconomy.ToString(), doc, table.Rows[3].Cells[11].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
//求和
//创建合计
rowhj = new Row(doc);
rowhj.Cells.Add(CreateCell("项目合计", doc, (table.Rows[4].Cells[0].CellFormat.Width)));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.FirstAidDressing ?? 0).Sum().ToString(), doc,
table.Rows[4].Cells[1].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.MedicalTreatment ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[2].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.WorkLimitation ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[3].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.LossCount ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[4].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.LossPerson ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[5].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.LossWorkTime ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[6].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.LossEconomy ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[7].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.DeathCount ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[8].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.DeathPerson ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[9].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.DeathWorkTime ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[10].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.DeathEconomy ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[11].CellFormat.Width));
table.Rows.Insert(numberIndex, rowhj);
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#region 6.2 HSE责任事故/
bkmark = doc.Range.Bookmarks["Def"];
if (bkmark != null)
{
bkmark.Text = model.AccidentDef.ToString();
}
#endregion
#region 6.3 HSE目标实现情况
bkmark = doc.Range.Bookmarks["Goalach1"];
if (bkmark != null)
{
bkmark.Text = model.Goalach1.ToString();
}
bkmark = doc.Range.Bookmarks["Goalach2"];
if (bkmark != null)
{
bkmark.Text = model.Goalach2.ToString();
}
bkmark = doc.Range.Bookmarks["Goalach3"];
if (bkmark != null)
{
bkmark.Text = model.Goalach3.ToString();
}
whileIndex += 1;
#endregion
#region 7.1 HSE工作计划
var otherWorkPlanCs = BLL.OtherWorkPlanCService.GetOtherWorkPlanByMonthReportId(Id);
isYm = true;
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
//跳过页眉的表头
while (isYm)
{
if (table.Range.Text.Substring(0, 2) != "序号")
{
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
}
else
{
isYm = false;
}
}
if (otherWorkPlanCs.Count > 0)
{
numberIndex = 1;
foreach (var item in otherWorkPlanCs)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.WorkContent, doc, table.FirstRow.Cells[1].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
numberIndex = 1;
Row row = new Row(doc);
row.Cells.Add(CreateCell("暂无数据", doc, table.FirstRow.Cells[0].CellFormat.Width
+ table.FirstRow.Cells[1].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#region 8 HSE合规义务识别与评价
var complianceObligationsCs = (from x in Funs.DB.Manager_Month_ComplianceObligationsC where x.MonthReportId == Id select x).ToList();
isYm = true;
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
//跳过页眉的表头
while (isYm)
{
if (table.Range.Text.Substring(0, 2) != "序号")
{
whileIndex += 1;
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
}
else
{
isYm = false;
}
}
if (complianceObligationsCs.Count > 0)
{
numberIndex = 1;
foreach (var item in complianceObligationsCs)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.InformationContent, doc, table.FirstRow.Cells[1].CellFormat.Width));
row.Cells.Add(CreateCell(item.ResponseMeasures, doc, table.FirstRow.Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.ImplementationStatus, doc, table.FirstRow.Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.EvaluationConclusion, doc, table.FirstRow.Cells[4].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
numberIndex = 1;
Row row = new Row(doc);
row.Cells.Add(CreateCell("暂无数据", doc, table.FirstRow.Cells[0].CellFormat.Width
+ table.FirstRow.Cells[1].CellFormat.Width + table.FirstRow.Cells[2].CellFormat.Width
+ table.FirstRow.Cells[3].CellFormat.Width
+ table.FirstRow.Cells[4].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#region 9
bkmark = doc.Range.Bookmarks["Question"];
if (bkmark != null)
{
bkmark.Text = model.Question.ToString();
}
#endregion
#region 10 HSE影像照片
var txtReportList = Funs.DB.Report_TextBoxContent.Where(x => x.ReportId == Id).ToList();
string imageUrl = "res/images/R-C.png";
var imageUrl1 = txtReportList.FirstOrDefault(x => x.ContentType == "10-1").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl1) && imageUrl1 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl1;
builder.MoveToBookmark("ImageUrl1");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl1, out JpgSize, out Wpx, out Hpx);
if (File.Exists(url))
{
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl2 = txtReportList.FirstOrDefault(x => x.ContentType == "10-2").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl2) && imageUrl2 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl2;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl2");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl2, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl3 = txtReportList.FirstOrDefault(x => x.ContentType == "10-3").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl3) && imageUrl3 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl3;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl3");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl3, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl4 = txtReportList.FirstOrDefault(x => x.ContentType == "10-4").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl4) && imageUrl4 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl4;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl4");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl4, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl5 = txtReportList.FirstOrDefault(x => x.ContentType == "10-5").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl5) && imageUrl5 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl5;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl5");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl5, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl6 = txtReportList.FirstOrDefault(x => x.ContentType == "10-6").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl6) && imageUrl6 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl6;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl6");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl6, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl7 = txtReportList.FirstOrDefault(x => x.ContentType == "10-7").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl7) && imageUrl7 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl7;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl7");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl7, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl8 = txtReportList.FirstOrDefault(x => x.ContentType == "10-8").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl8) && imageUrl8 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl8;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl8");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl8, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl9 = txtReportList.FirstOrDefault(x => x.ContentType == "10-9").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl9) && imageUrl9 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl9;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl9");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl9, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl10 = txtReportList.FirstOrDefault(x => x.ContentType == "10-10").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl10) && imageUrl10 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl10;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl10");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl10, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl11 = txtReportList.FirstOrDefault(x => x.ContentType == "10-11").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl11) && imageUrl11 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl11;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl11");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl11, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl12 = txtReportList.FirstOrDefault(x => x.ContentType == "10-12").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl12) && imageUrl12 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl12;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl12");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl12, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
#region
bkmark = doc.Range.Bookmarks["ImageContent1"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-1").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent2"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-2").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent3"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-3").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent4"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-4").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent5"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-5").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent6"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-6").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent7"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-7").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent8"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-8").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent9"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-9").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent10"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-10").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent11"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-11").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent12"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-12").ContentText;
}
#endregion
#endregion
#region
@@ -982,7 +1895,7 @@ namespace FineUIPro.Web.HSSE.Manager
//项目名称
table.Rows[1].Cells[2].FirstParagraph.Runs[0].Text = pModel.ProjectName;
table.Rows[1].Cells[3].FirstParagraph.Runs[0].Text = pModel.ProjectCode + "-RM-PQM-" + model.MonthReportCode;
table.Rows[1].Cells[3].FirstParagraph.Runs[0].Text = pModel.ProjectCode + "-RM-HSE-" + model.MonthReportCode;
//总页数
table.Rows[2].Cells[7].FirstParagraph.Runs[0].Text = doc.PageCount.ToString();