20240407 质量月报17、23
This commit is contained in:
@@ -1142,22 +1142,996 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
#endregion
|
||||
|
||||
var reportItem = db.Report_CQMS_MonthReportItem.Where(x => x.ReportId == Id).OrderBy(x => x.ContentName).ToList();
|
||||
|
||||
#region 9.计量器具报验管理情况
|
||||
var measuringInspection = reportItem.Where(x => x.ReType == "9").ToList();
|
||||
if (measuringInspection.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
//whileIndex += 1;
|
||||
whileIndex = 13;
|
||||
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;
|
||||
int? num1 = 0, num2 = 0;
|
||||
foreach (var item in measuringInspection)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContentName, doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MonthsCount.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ProjectCount.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.Remarks, doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, row);
|
||||
num1 += item.MonthsCount;
|
||||
num2 += item.ProjectCount;
|
||||
numberIndex += 1;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num1.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num2.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 10.现场质量共检数据
|
||||
#region 10-1 土建
|
||||
var TJInspection = reportItem.Where(x => x.ReType == "10-4").ToList();
|
||||
if (TJInspection.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
//whileIndex += 1;
|
||||
whileIndex = 14;
|
||||
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;
|
||||
int? num1 = 0, num2 = 0, num3 = 0, num4 = 0;
|
||||
string num5 = string.Empty;
|
||||
string num6 = string.Empty;
|
||||
foreach (var item in TJInspection)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContentName, doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
// 合并第一行的前两个单元格
|
||||
table.Rows[0].Cells[0].CellFormat.VerticalMerge = CellMerge.First;
|
||||
table.Rows[1].Cells[0].CellFormat.VerticalMerge = CellMerge.Previous;
|
||||
|
||||
row.Cells.Add(CreateCell(item.MonthsCount.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MonthsBackCount.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.ProjectCount.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.TotalNoBackCount.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.RectificationRate.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.Remarks.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, row);
|
||||
|
||||
num1 += item.MonthsCount;
|
||||
num2 += item.MonthsBackCount;
|
||||
num3 += item.ProjectCount;
|
||||
num4 += item.TotalNoBackCount;
|
||||
|
||||
numberIndex += 1;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
|
||||
if (num1 != 0)//被除数不能为零
|
||||
{
|
||||
num5 = Math.Round((double)num3 / (double)num1 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num5 = "0%";
|
||||
}
|
||||
if (num2 != 0)//被除数不能为零
|
||||
{
|
||||
num6 = Math.Round((double)num4 / (double)num2 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num6 = "0%";
|
||||
}
|
||||
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num1.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num2.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num3.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num4.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num5.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num6.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 10-2 设备
|
||||
var SBInspection = reportItem.Where(x => x.ReType == "10-2").ToList();
|
||||
if (SBInspection.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
//whileIndex += 1;
|
||||
whileIndex = 15;
|
||||
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;
|
||||
int? num1 = 0, num2 = 0, num3 = 0, num4 = 0;
|
||||
string num5 = string.Empty;
|
||||
string num6 = string.Empty;
|
||||
foreach (var item in SBInspection)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContentName, doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
// 合并第一行的前两个单元格
|
||||
table.Rows[0].Cells[0].CellFormat.VerticalMerge = CellMerge.First;
|
||||
table.Rows[1].Cells[0].CellFormat.VerticalMerge = CellMerge.Previous;
|
||||
|
||||
row.Cells.Add(CreateCell(item.MonthsCount.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MonthsBackCount.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.ProjectCount.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.TotalNoBackCount.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.RectificationRate.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.Remarks.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, row);
|
||||
|
||||
num1 += item.MonthsCount;
|
||||
num2 += item.MonthsBackCount;
|
||||
num3 += item.ProjectCount;
|
||||
num4 += item.TotalNoBackCount;
|
||||
|
||||
numberIndex += 1;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
|
||||
if (num1 != 0)//被除数不能为零
|
||||
{
|
||||
num5 = Math.Round((double)num3 / (double)num1 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num5 = "0%";
|
||||
}
|
||||
if (num2 != 0)//被除数不能为零
|
||||
{
|
||||
num6 = Math.Round((double)num4 / (double)num2 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num6 = "0%";
|
||||
}
|
||||
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num1.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num2.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num3.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num4.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num5.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num6.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 10-3 管道
|
||||
var GDInspection = reportItem.Where(x => x.ReType == "10-3").ToList();
|
||||
if (GDInspection.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
//whileIndex += 1;
|
||||
whileIndex = 16;
|
||||
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;
|
||||
int? num1 = 0, num2 = 0, num3 = 0, num4 = 0;
|
||||
string num5 = string.Empty;
|
||||
string num6 = string.Empty;
|
||||
foreach (var item in GDInspection)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContentName, doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
// 合并第一行的前两个单元格
|
||||
table.Rows[0].Cells[0].CellFormat.VerticalMerge = CellMerge.First;
|
||||
table.Rows[1].Cells[0].CellFormat.VerticalMerge = CellMerge.Previous;
|
||||
|
||||
row.Cells.Add(CreateCell(item.MonthsCount.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MonthsBackCount.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.ProjectCount.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.TotalNoBackCount.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.RectificationRate.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.Remarks.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, row);
|
||||
|
||||
num1 += item.MonthsCount;
|
||||
num2 += item.MonthsBackCount;
|
||||
num3 += item.ProjectCount;
|
||||
num4 += item.TotalNoBackCount;
|
||||
|
||||
numberIndex += 1;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
|
||||
if (num1 != 0)//被除数不能为零
|
||||
{
|
||||
num5 = Math.Round((double)num3 / (double)num1 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num5 = "0%";
|
||||
}
|
||||
if (num2 != 0)//被除数不能为零
|
||||
{
|
||||
num6 = Math.Round((double)num4 / (double)num2 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num6 = "0%";
|
||||
}
|
||||
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num1.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num2.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num3.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num4.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num5.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num6.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 10-4 电气
|
||||
var DQInspection = reportItem.Where(x => x.ReType == "10-4").ToList();
|
||||
if (DQInspection.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
//whileIndex += 1;
|
||||
whileIndex = 17;
|
||||
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;
|
||||
int? num1 = 0, num2 = 0, num3 = 0, num4 = 0;
|
||||
string num5 = string.Empty;
|
||||
string num6 = string.Empty;
|
||||
foreach (var item in DQInspection)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContentName, doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
// 合并第一行的前两个单元格
|
||||
table.Rows[0].Cells[0].CellFormat.VerticalMerge = CellMerge.First;
|
||||
table.Rows[1].Cells[0].CellFormat.VerticalMerge = CellMerge.Previous;
|
||||
|
||||
row.Cells.Add(CreateCell(item.MonthsCount.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MonthsBackCount.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.ProjectCount.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.TotalNoBackCount.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.RectificationRate.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.Remarks.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, row);
|
||||
|
||||
num1 += item.MonthsCount;
|
||||
num2 += item.MonthsBackCount;
|
||||
num3 += item.ProjectCount;
|
||||
num4 += item.TotalNoBackCount;
|
||||
|
||||
numberIndex += 1;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
|
||||
if (num1 != 0)//被除数不能为零
|
||||
{
|
||||
num5 = Math.Round((double)num3 / (double)num1 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num5 = "0%";
|
||||
}
|
||||
if (num2 != 0)//被除数不能为零
|
||||
{
|
||||
num6 = Math.Round((double)num4 / (double)num2 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num6 = "0%";
|
||||
}
|
||||
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num1.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num2.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num3.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num4.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num5.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num6.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 10-5.仪表
|
||||
var YBInspection = reportItem.Where(x => x.ReType == "10-5").ToList();
|
||||
if (YBInspection.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
//whileIndex += 1;
|
||||
whileIndex = 18;
|
||||
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;
|
||||
int? num1 = 0, num2 = 0, num3 = 0, num4 = 0;
|
||||
string num5 = string.Empty;
|
||||
string num6 = string.Empty;
|
||||
foreach (var item in YBInspection)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContentName, doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
// 合并第一行的前两个单元格
|
||||
table.Rows[0].Cells[0].CellFormat.VerticalMerge = CellMerge.First;
|
||||
table.Rows[1].Cells[0].CellFormat.VerticalMerge = CellMerge.Previous;
|
||||
|
||||
row.Cells.Add(CreateCell(item.MonthsCount.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MonthsBackCount.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.ProjectCount.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.TotalNoBackCount.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.RectificationRate.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.Remarks.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, row);
|
||||
|
||||
num1 += item.MonthsCount;
|
||||
num2 += item.MonthsBackCount;
|
||||
num3 += item.ProjectCount;
|
||||
num4 += item.TotalNoBackCount;
|
||||
|
||||
numberIndex += 1;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
|
||||
if (num1 != 0)//被除数不能为零
|
||||
{
|
||||
num5 = Math.Round((double)num3 / (double)num1 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num5 = "0%";
|
||||
}
|
||||
if (num2 != 0)//被除数不能为零
|
||||
{
|
||||
num6 = Math.Round((double)num4 / (double)num2 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num6 = "0%";
|
||||
}
|
||||
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num1.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num2.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num3.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num4.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num5.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num6.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 10-6.防腐
|
||||
var FFInspection = reportItem.Where(x => x.ReType == "10-6").ToList();
|
||||
if (FFInspection.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
//whileIndex += 1;
|
||||
whileIndex = 19;
|
||||
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;
|
||||
int? num1 = 0, num2 = 0, num3 = 0, num4 = 0;
|
||||
string num5 = string.Empty;
|
||||
string num6 = string.Empty;
|
||||
foreach (var item in FFInspection)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContentName, doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
// 合并第一行的前两个单元格
|
||||
table.Rows[0].Cells[0].CellFormat.VerticalMerge = CellMerge.First;
|
||||
table.Rows[1].Cells[0].CellFormat.VerticalMerge = CellMerge.Previous;
|
||||
|
||||
row.Cells.Add(CreateCell(item.MonthsCount.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MonthsBackCount.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.ProjectCount.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.TotalNoBackCount.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.RectificationRate.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.Remarks.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, row);
|
||||
|
||||
num1 += item.MonthsCount;
|
||||
num2 += item.MonthsBackCount;
|
||||
num3 += item.ProjectCount;
|
||||
num4 += item.TotalNoBackCount;
|
||||
|
||||
numberIndex += 1;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
|
||||
if (num1 != 0)//被除数不能为零
|
||||
{
|
||||
num5 = Math.Round((double)num3 / (double)num1 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num5 = "0%";
|
||||
}
|
||||
if (num2 != 0)//被除数不能为零
|
||||
{
|
||||
num6 = Math.Round((double)num4 / (double)num2 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num6 = "0%";
|
||||
}
|
||||
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num1.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num2.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num3.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num4.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num5.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num6.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 10-7.消防
|
||||
var XFInspection = reportItem.Where(x => x.ReType == "10-7").ToList();
|
||||
if (XFInspection.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
//whileIndex += 1;
|
||||
whileIndex = 20;
|
||||
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;
|
||||
int? num1 = 0, num2 = 0, num3 = 0, num4 = 0;
|
||||
string num5 = string.Empty;
|
||||
string num6 = string.Empty;
|
||||
foreach (var item in XFInspection)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContentName, doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
// 合并第一行的前两个单元格
|
||||
table.Rows[0].Cells[0].CellFormat.VerticalMerge = CellMerge.First;
|
||||
table.Rows[1].Cells[0].CellFormat.VerticalMerge = CellMerge.Previous;
|
||||
|
||||
row.Cells.Add(CreateCell(item.MonthsCount.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MonthsBackCount.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.ProjectCount.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.TotalNoBackCount.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
|
||||
row.Cells.Add(CreateCell(item.RectificationRate.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.Remarks.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, row);
|
||||
|
||||
num1 += item.MonthsCount;
|
||||
num2 += item.MonthsBackCount;
|
||||
num3 += item.ProjectCount;
|
||||
num4 += item.TotalNoBackCount;
|
||||
|
||||
numberIndex += 1;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
|
||||
if (num1 != 0)//被除数不能为零
|
||||
{
|
||||
num5 = Math.Round((double)num3 / (double)num1 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num5 = "0%";
|
||||
}
|
||||
if (num2 != 0)//被除数不能为零
|
||||
{
|
||||
num6 = Math.Round((double)num4 / (double)num2 * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
num6 = "0%";
|
||||
}
|
||||
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.Rows[0].Cells[0].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num1.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num2.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num3.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num4.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num5.ToString(), doc, table.Rows[1].Cells[6].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num6.ToString(), doc, table.Rows[1].Cells[7].CellFormat.Width));
|
||||
|
||||
table.Rows.Insert(numberIndex + 1, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 10.总数
|
||||
var InspectionDataInspection = reportItem.Where(x => x.ReType == "10").ToList();
|
||||
if (InspectionDataInspection.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
//whileIndex += 1;
|
||||
whileIndex = 21;
|
||||
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;
|
||||
int? num1 = 0, num2 = 0;
|
||||
foreach (var item in InspectionDataInspection)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContentName, doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MonthsCount.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ProjectCount.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.Remarks, doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, row);
|
||||
num1 += item.MonthsCount;
|
||||
num2 += item.ProjectCount;
|
||||
numberIndex += 1;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num1.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num2.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 11.压力管道监检情况
|
||||
var PressureInspection = reportItem.Where(x => x.ReType == "11").ToList();
|
||||
if (PressureInspection.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
//whileIndex += 1;
|
||||
whileIndex = 22;
|
||||
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;
|
||||
int? num1 = 0, num2 = 0, num3 = 0;
|
||||
foreach (var item in PressureInspection)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContentName, doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MonthsCount.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ProjectCount.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.TotalNoBackCount.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.Remarks, doc, table.FirstRow.Cells[5].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, row);
|
||||
num1 += item.MonthsCount;
|
||||
num2 += item.ProjectCount;
|
||||
num3 += item.TotalNoBackCount;
|
||||
numberIndex += 1;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num1.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num2.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num3.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.FirstRow.Cells[5].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 12.管道试压包管理情况
|
||||
var PipingInspection = reportItem.Where(x => x.ReType == "12").ToList();
|
||||
if (PipingInspection.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
//whileIndex += 1;
|
||||
whileIndex = 23;
|
||||
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;
|
||||
int? num1 = 0, num2 = 0, num3 = 0;
|
||||
foreach (var item in PipingInspection)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContentName, doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.TotalNoBackCount.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MonthsCount.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ProjectCount.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.Remarks, doc, table.FirstRow.Cells[5].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, row);
|
||||
num3 += item.TotalNoBackCount;
|
||||
num1 += item.MonthsCount;
|
||||
num2 += item.ProjectCount;
|
||||
numberIndex += 1;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num3.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num1.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num2.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.FirstRow.Cells[5].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 13.特种设备监检情况
|
||||
var SpecialInspection = reportItem.Where(x => x.ReType == "13").ToList();
|
||||
if (SpecialInspection.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
//whileIndex += 1;
|
||||
whileIndex = 24;
|
||||
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;
|
||||
int? num1 = 0, num2 = 0, num3 = 0;
|
||||
foreach (var item in SpecialInspection)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContentName, doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.TotalNoBackCount.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MonthsCount.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ProjectCount.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.Remarks, doc, table.FirstRow.Cells[5].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, row);
|
||||
num1 += item.MonthsCount;
|
||||
num2 += item.ProjectCount;
|
||||
num3 += item.TotalNoBackCount;
|
||||
numberIndex += 1;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num3.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num1.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num2.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 14.NCR管理情况
|
||||
var NcrManagementInspection = reportItem.Where(x => x.ReType == "14").ToList();
|
||||
if (NcrManagementInspection.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
//whileIndex += 1;
|
||||
whileIndex = 25;
|
||||
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;
|
||||
int? num1 = 0, num2 = 0, num3 = 0;
|
||||
string num4 = string.Empty;
|
||||
foreach (var item in NcrManagementInspection)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContentName, doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MonthsCount.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ProjectCount.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.TotalNoBackCount.HasValue ? item.TotalNoBackCount.ToString() : "0", doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.RectificationRate.ToString(), doc, table.FirstRow.Cells[5].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, row);
|
||||
num1 += item.MonthsCount;
|
||||
num2 += item.ProjectCount;
|
||||
num3 += item.TotalNoBackCount;
|
||||
numberIndex += 1;
|
||||
}
|
||||
|
||||
if (num2 != 0)//被除数不能为零
|
||||
{
|
||||
num4 = Math.Round((double)num2 / (double)num3 * 100, 2) + "%";//保留两位小数、后四舍五3
|
||||
}
|
||||
else
|
||||
{
|
||||
num4 = "0%";
|
||||
}
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num1.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num2.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num3.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(num4.ToString(), doc, table.FirstRow.Cells[5].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 15.质量巡检情况
|
||||
|
||||
Reference in New Issue
Block a user