20240331 质量月报

This commit is contained in:
2024-03-31 01:12:53 +08:00
parent 1791d28bde
commit 4aa229ef1f
54 changed files with 6959 additions and 1709 deletions
@@ -104,10 +104,8 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
//本月质量目标管理情况
CqmsTargetService.Delete(rowID);
TextBoxContentService.Delete(rowID);
Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(rowID);
WeekAndMonthReportNewService.Delete(rowID);
}
BindGrid();
@@ -889,9 +887,327 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#endregion
doc.Save(newUrl);
var reportItem = db.Report_CQMS_MonthReportItem.Where(x => x.ReportId == Id).OrderBy(x => x.ContentName).ToList();
#region 9.
#endregion
#region 10.
#endregion
#region 11.
#endregion
#region 12.
#endregion
#region 13.
#endregion
#region 14.NCR管理情况
#endregion
#region 15.
var qualityInspections = reportItem.Where(x => x.ReType == "1").ToList();
if (qualityInspections.Count > 0)
{
isYm = true;
//whileIndex += 1;
whileIndex = 26;
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 qualityInspections)
{
//创建行
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.RectificationRate, 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;
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));
rowhj.Cells.Add(CreateCell("", doc, table.FirstRow.Cells[5].CellFormat.Width));
table.Rows.Insert(numberIndex, rowhj);
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#region 16.
var specialChecks = reportItem.Where(x => x.ReType == "2").ToList();
if (specialChecks.Count > 0)
{
isYm = true;
//whileIndex += 1;
whileIndex = 27;
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 specialChecks)
{
//创建行
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 17.
var fileReports = reportItem.Where(x => x.ReType == "3").ToList();
if (fileReports.Count > 0)
{
isYm = true;
//whileIndex += 1;
whileIndex = 28;
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;
foreach (var item in fileReports)
{
//创建行
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.MonthsBackCount.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
row.Cells.Add(CreateCell(item.TotalNoBackCount.ToString(), doc, table.FirstRow.Cells[5].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
num1 += item.MonthsCount;
num2 += item.ProjectCount;
num3 += item.MonthsBackCount;
num4 += 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(num4.ToString(), doc, table.FirstRow.Cells[5].CellFormat.Width));
table.Rows.Insert(numberIndex, rowhj);
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#region 18.
#region (1)
whileIndex = 29;
Aspose.Words.Tables.Table table18_1 = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
bool isYm18_1 = true;
//跳过页眉的表头
while (isYm18_1)
{
if (table18_1.Range.Text.Substring(0, 2) != "序号")
{
whileIndex += 1;
table18_1 = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
}
else
{
isYm18_1 = false;
}
}
var rowMaterialProblems = db.Report_RowMaterialProblem.Where(x => x.ReportId == Id);
int numberIndex18_1 = 1;
foreach (var item in rowMaterialProblems)
{
//创建行
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex18_1.ToString(), doc, table18_1.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.UnitId, doc, table18_1.FirstRow.Cells[1].CellFormat.Width));
row.Cells.Add(CreateCell(item.ProblemDesrioption, doc, table18_1.FirstRow.Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.TreatmentMeasures, doc, table18_1.FirstRow.Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.ProcessingResults, doc, table18_1.FirstRow.Cells[4].CellFormat.Width));
row.Cells.Add(CreateCell(item.Remark, doc, table18_1.FirstRow.Cells[5].CellFormat.Width));
table18_1.Rows.Insert(numberIndex18_1, row);
numberIndex18_1 += 1;
}
//自动设置表格样式
table18_1.AutoFit(AutoFitBehavior.FixedColumnWidths);
#endregion
#region (2)
whileIndex = 30;
Aspose.Words.Tables.Table table18_2 = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
bool isYm18_2 = true;
//跳过页眉的表头
while (isYm18_2)
{
if (table18_2.Range.Text.Substring(0, 2) != "序号")
{
whileIndex += 1;
table18_2 = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
}
else
{
isYm18_2 = false;
}
}
var constructionProblems = db.Report_ConstructionProblems.Where(x => x.ReportId == Id);
int numberIndex18_2 = 1;
foreach (var item in constructionProblems)
{
//创建行
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex18_2.ToString(), doc, table18_2.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.UnitId, doc, table18_2.FirstRow.Cells[1].CellFormat.Width));
row.Cells.Add(CreateCell(item.ProblemDesrioption, doc, table18_2.FirstRow.Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.TreatmentMeasures, doc, table18_2.FirstRow.Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.ProcessingResults, doc, table18_2.FirstRow.Cells[4].CellFormat.Width));
row.Cells.Add(CreateCell(item.Remark, doc, table18_2.FirstRow.Cells[5].CellFormat.Width));
table18_2.Rows.Insert(numberIndex18_2, row);
numberIndex18_2 += 1;
}
//自动设置表格样式
table18_2.AutoFit(AutoFitBehavior.FixedColumnWidths);
#endregion
#endregion
#region 19.
whileIndex = 31;
Aspose.Words.Tables.Table table19 = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
bool isYm19 = true;
//跳过页眉的表头
while (isYm19)
{
if (table19.Range.Text.Substring(0, 2) != "序号")
{
whileIndex += 1;
table19 = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
}
else
{
isYm19 = false;
}
}
var nextQualityControls = db.Report_NextQualityControl.Where(x => x.ReportId == Id);
int numberIndex19 = 1;
foreach (var item in nextQualityControls)
{
//创建行
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex19.ToString(), doc, table19.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.NextQualityControlContent, doc, table19.FirstRow.Cells[1].CellFormat.Width));
table19.Rows.Insert(numberIndex19, row);
numberIndex19 += 1;
}
//自动设置表格样式
table19.AutoFit(AutoFitBehavior.FixedColumnWidths);
#endregion
#region 20.
bkmark = doc.Range.Bookmarks["Content20"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "20").ContentText;
}
#endregion
#region 21.
bkmark = doc.Range.Bookmarks["Content21"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "21").ContentText;
}
#endregion
#region 22.
bkmark = doc.Range.Bookmarks["Content22"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "22").ContentText;
}
#endregion
doc.Save(newUrl);
string fileName = Path.GetFileName(newUrl);
FileInfo info = new FileInfo(newUrl);
long fileSize = info.Length;