五环质量月报修改
This commit is contained in:
@@ -152,12 +152,33 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
* @param doc Document对象
|
||||
* @return
|
||||
*/
|
||||
public static Cell CreateCell(String value, Document doc, double cellWidth)
|
||||
public static Cell CreateCell(String value, Document doc, double cellWidth, string cellMerge = "")
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -608,7 +629,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
}
|
||||
}
|
||||
int i = 1;
|
||||
var cNProfessionals = from x in Funs.DB.Base_CNProfessional orderby x.SortIndex select x;
|
||||
var cNProfessionals = from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId orderby x.SortIndex select x;
|
||||
foreach (var item in cNProfessionals)
|
||||
{
|
||||
//专业下所有集合
|
||||
@@ -889,6 +910,237 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
}
|
||||
#endregion
|
||||
|
||||
#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;
|
||||
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;
|
||||
//需要插入的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);
|
||||
numberIndex += 1;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
//创建合计
|
||||
//创建行
|
||||
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
|
||||
|
||||
var reportItem = db.Report_CQMS_MonthReportItem.Where(x => x.ReportId == Id).OrderBy(x => x.ContentName).ToList();
|
||||
#region 9.计量器具报验管理情况
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user