20240331 质量月报

This commit is contained in:
2024-03-31 01:32:14 +08:00
parent 524662b9ed
commit e7ecb0302a
4 changed files with 125 additions and 443 deletions
@@ -152,31 +152,12 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
* @param doc Document对象
* @return
*/
public static Cell CreateCell(String value, Document doc, double cellWidth,string cellMerge="")
public static Cell CreateCell(String value, Document doc, double cellWidth)
{
Cell cell = new Cell(doc);
Paragraph p = new Paragraph(doc);
if (!string.IsNullOrEmpty(cellMerge))
{
if (cellMerge == "0")
{
cell.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.First;//竖直方向合并的第一个单元格
}
else {
cell.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.Previous;//竖直方向合并的第一个单元格
}
}
else {
cell.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
}
p.AppendChild(new Run(doc, value));
cell.CellFormat.Width = cellWidth;
cell.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;
cell.AppendChild(p);
return cell;
}
@@ -339,30 +320,6 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "2").ContentText;
}
bkmark = doc.Range.Bookmarks["Content8"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "8").ContentText;
}
bkmark = doc.Range.Bookmarks["Content20"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "20").ContentText;
}
bkmark = doc.Range.Bookmarks["Content21"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "21").ContentText;
}
bkmark = doc.Range.Bookmarks["Content22"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "22").ContentText;
}
#endregion
var ContuructionAllList = db.Report_Construction_Plan.Where(x => x.ReportId == Id).OrderBy(x=>x.UnitOrMajor).ToList();
@@ -651,7 +608,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
}
}
int i = 1;
var cNProfessionals = from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId orderby x.SortIndex select x;
var cNProfessionals = from x in Funs.DB.Base_CNProfessional orderby x.SortIndex select x;
foreach (var item in cNProfessionals)
{
//专业下所有集合
@@ -932,7 +889,6 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
}
#endregion
<<<<<<< HEAD
var reportItem = db.Report_CQMS_MonthReportItem.Where(x => x.ReportId == Id).OrderBy(x => x.ContentName).ToList();
#region 9.
@@ -960,171 +916,6 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
isYm = true;
//whileIndex += 1;
whileIndex = 26;
=======
#region 7.3
var NondestructiveTestlist = new List<Model.ProcessControl_NondestructiveTest_New>();
//加载所有施工分包单位
units = from x in Funs.DB.Project_ProjectUnit
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
where x.ProjectId == this.CurrUser.LoginProjectId && (x.UnitType == BLL.Const.ProjectUnitType_2)
orderby y.UnitCode
select new { x.UnitId, y.UnitName };
int? totalNum0 = 0, totalNum1 = 0;//拍片数量合计
foreach (var item in units)
{
int? num0 = 0, num1 = 0;//拍片数量小计
var query = from c in db.ProcessControl_NondestructiveTest_New
join u in db.Base_Unit on c.UnitId equals u.UnitId
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
&& c.CreateDate >= Convert.ToDateTime(startDate) && c.CreateDate <= Convert.ToDateTime(endDate)
orderby c.CreateDate descending
select new
{
c.CreateDate,
c.ProjectId,
u.UnitId,
u.UnitName,
c.ProfessionalName,
c.MonthQuantity,
c.TotalQuantity,
c.MonthRate,
c.TotalRate
};
if (query.ToList().Count > 0)
{
//加载工艺管道
var gygdModel = query.FirstOrDefault(x => x.ProfessionalName == "工艺管道");
var model = new Model.ProcessControl_NondestructiveTest_New();
model.Id = Guid.NewGuid().ToString();
model.CreateMan = item.UnitName;//用作存储施工单位名称
model.ProfessionalName = "工艺管道";
if (gygdModel != null)
{
model.MonthQuantity = gygdModel.MonthQuantity;
model.TotalQuantity = gygdModel.TotalQuantity;
model.MonthRate = gygdModel.MonthRate + "%";
model.TotalRate = gygdModel.TotalRate + "%";
#region
//小计
num0 += gygdModel.MonthQuantity;
num1 += gygdModel.TotalQuantity;
//合计
totalNum0 += gygdModel.MonthQuantity;
totalNum1 += gygdModel.TotalQuantity;
#endregion
NondestructiveTestlist.Add(model);
}
else
{
model.MonthQuantity = 0;
model.TotalQuantity = 0;
model.MonthRate = "0%";
model.TotalRate = "0%";
NondestructiveTestlist.Add(model);
}
//地管
gygdModel = query.FirstOrDefault(x => x.ProfessionalName == "地管");
model = new Model.ProcessControl_NondestructiveTest_New();
model.Id = Guid.NewGuid().ToString();
model.CreateMan = item.UnitName;//用作存储施工单位名称
model.ProfessionalName = "地管";
if (gygdModel != null)
{
model.MonthQuantity = gygdModel.MonthQuantity;
model.TotalQuantity = gygdModel.TotalQuantity;
model.MonthRate = gygdModel.MonthRate + "%";
model.TotalRate = gygdModel.TotalRate + "%";
#region
//小计
num0 += gygdModel.MonthQuantity;
num1 += gygdModel.TotalQuantity;
//合计
totalNum0 += gygdModel.MonthQuantity;
totalNum1 += gygdModel.TotalQuantity;
#endregion
NondestructiveTestlist.Add(model);
}
else
{
model.MonthQuantity = 0;
model.TotalQuantity = 0;
model.MonthRate = "0%";
model.TotalRate = "0%";
NondestructiveTestlist.Add(model);
}
//非标
gygdModel = query.FirstOrDefault(x => x.ProfessionalName == "非标");
model = new Model.ProcessControl_NondestructiveTest_New();
model.Id = Guid.NewGuid().ToString();
model.CreateMan = item.UnitName;//用作存储施工单位名称
model.ProfessionalName = "非标";
if (gygdModel != null)
{
model.MonthQuantity = gygdModel.MonthQuantity;
model.TotalQuantity = gygdModel.TotalQuantity;
model.MonthRate = gygdModel.MonthRate + "%";
model.TotalRate = gygdModel.TotalRate + "%";
#region
//小计
num0 += gygdModel.MonthQuantity;
num1 += gygdModel.TotalQuantity;
//合计
totalNum0 += gygdModel.MonthQuantity;
totalNum1 += gygdModel.TotalQuantity;
#endregion
NondestructiveTestlist.Add(model);
}
else
{
model.MonthQuantity = 0;
model.TotalQuantity = 0;
model.MonthRate = "0%";
model.TotalRate = "0%";
NondestructiveTestlist.Add(model);
}
//小计
model = new Model.ProcessControl_NondestructiveTest_New();
model.Id = Guid.NewGuid().ToString();
model.CreateMan = item.UnitName;//用作存储施工单位名称
model.ProfessionalName = "小计";
model.MonthQuantity = num0;
model.TotalQuantity = num1;
model.MonthRate = "";
model.TotalRate = "";
NondestructiveTestlist.Add(model);
}
}
if (NondestructiveTestlist.Count>0)
{
isYm = true;
whileIndex += 1;
>>>>>>> 0ae4143492852fa438a0c21d967acf7271ee604e
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
//跳过页眉的表头
while (isYm)
@@ -1140,7 +931,6 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
}
}
numberIndex = 1;
<<<<<<< HEAD
int? num1 = 0, num2 = 0;
foreach (var item in qualityInspections)
{
@@ -1155,105 +945,11 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
table.Rows.Insert(numberIndex, row);
num1 += item.MonthsCount;
num2 += item.ProjectCount;
=======
//需要插入的table
var Unitname = "";
foreach (var item in NondestructiveTestlist)
{
//创建行
Row row = new Row(doc);
row.Cells.Add(CreateCell((numberIndex).ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width));
//如果是第一列,或者
if (numberIndex==1 || Unitname!= item.CreateMan)
{
row.Cells.Add(CreateCell(item.CreateMan, doc, table.Rows[0].Cells[1].CellFormat.Width,"0"));
Unitname = item.CreateMan;
}
else {
row.Cells.Add(CreateCell(item.CreateMan, doc, table.Rows[0].Cells[1].CellFormat.Width, "1"));
Unitname = item.CreateMan;
}
row.Cells.Add(CreateCell(item.ProfessionalName.ToString(), doc, table.Rows[0].Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.MonthQuantity.ToString(), doc, table.Rows[0].Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.TotalQuantity.ToString(), doc, table.Rows[0].Cells[4].CellFormat.Width));
row.Cells.Add(CreateCell(item.MonthRate.ToString(), doc, table.Rows[0].Cells[5].CellFormat.Width));
row.Cells.Add(CreateCell(item.TotalRate.ToString(), doc, table.Rows[0].Cells[6].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
>>>>>>> 0ae4143492852fa438a0c21d967acf7271ee604e
numberIndex += 1;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
//创建合计
<<<<<<< HEAD
=======
//创建行
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("", doc, table.Rows[0].Cells[2].CellFormat.Width));
rowhj.Cells.Add(CreateCell(totalNum0.ToString(), doc, table.Rows[0].Cells[3].CellFormat.Width));
rowhj.Cells.Add(CreateCell(totalNum1.ToString(), doc, table.Rows[0].Cells[4].CellFormat.Width));
rowhj.Cells.Add(CreateCell("", doc, table.Rows[0].Cells[5].CellFormat.Width));
rowhj.Cells.Add(CreateCell("", doc, table.Rows[0].Cells[6].CellFormat.Width));
table.Rows.Insert(numberIndex, rowhj);
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#region 8.
var sbclbyList = ContuructionAllList.Where(x => x.ReType == "6").ToList();
if (pqrList.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;
int? num1 = 0, num2 = 0;
foreach (var item in sbclbyList)
{
//创建行
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.UnitOrMajor, doc, table.FirstRow.Cells[1].CellFormat.Width));
row.Cells.Add(CreateCell(item.Quantity1.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.Quantity2.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.QuaRate.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.Quantity1;
num2 += item.Quantity2;
numberIndex += 1;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
//创建合计
//创建行
>>>>>>> 0ae4143492852fa438a0c21d967acf7271ee604e
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));
@@ -1266,7 +962,6 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
<<<<<<< HEAD
#endregion
#region 16.
@@ -1510,9 +1205,6 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "22").ContentText;
}
=======
>>>>>>> 0ae4143492852fa438a0c21d967acf7271ee604e
#endregion
doc.Save(newUrl);