质量月报修改导出
This commit is contained in:
parent
866f4989ea
commit
87ed94f69c
|
@ -152,7 +152,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
* @param doc Document对象
|
* @param doc Document对象
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Cell CreateCell(String value, Document doc, double cellWidth, string cellMerge = "")
|
public static Cell CreateCell(String value, Document doc, double cellWidth, string cellMerge = "",string CenterPage="")
|
||||||
{
|
{
|
||||||
Cell cell = new Cell(doc);
|
Cell cell = new Cell(doc);
|
||||||
Paragraph p = new Paragraph(doc);
|
Paragraph p = new Paragraph(doc);
|
||||||
|
@ -172,6 +172,12 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
{
|
{
|
||||||
cell.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
|
cell.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrEmpty(CenterPage))
|
||||||
|
{
|
||||||
|
//序号
|
||||||
|
value = " " + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
p.AppendChild(new Run(doc, value));
|
p.AppendChild(new Run(doc, value));
|
||||||
|
|
||||||
|
@ -211,8 +217,10 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
var endDate = Convert.ToDateTime(weekModel.EndDate);
|
var endDate = Convert.ToDateTime(weekModel.EndDate);
|
||||||
//获取project
|
//获取project
|
||||||
var pModel = db.Base_Project.FirstOrDefault(x => x.ProjectId == weekModel.ProjectId);
|
var pModel = db.Base_Project.FirstOrDefault(x => x.ProjectId == weekModel.ProjectId);
|
||||||
|
var urlHz = startDate.ToString("yyyyMMdd")+"-"
|
||||||
|
+ endDate.ToString("yyyyMMdd");
|
||||||
|
|
||||||
newUrl = uploadfilepath.Replace("项目质量月报", pModel.ShortName + "项目质量月报(第"+ weekModel.SortId + "期)");
|
newUrl = uploadfilepath.Replace("项目质量月报", pModel.ShortName + "项目质量月报(第"+ weekModel.SortId + "期)"+ urlHz);
|
||||||
|
|
||||||
if (File.Exists(newUrl))
|
if (File.Exists(newUrl))
|
||||||
{
|
{
|
||||||
|
@ -268,14 +276,19 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
|
|
||||||
bkmark = doc.Range.Bookmarks["quamanagername"];
|
bkmark = doc.Range.Bookmarks["quamanagername"];
|
||||||
if (bkmark != null) {
|
if (bkmark != null) {
|
||||||
var zlName = "";
|
//var zlName = "";
|
||||||
//根据项目获取质量经理
|
////根据项目获取质量经理
|
||||||
var puserList = db.Project_ProjectUser.Where(x => x.ProjectId == weekModel.ProjectId && x.RoleId.Contains(BLL.Const.QAManager)).ToList();
|
//var puserList = db.Project_ProjectUser.Where(x => x.ProjectId == weekModel.ProjectId && x.RoleId.Contains(BLL.Const.QAManager)).ToList();
|
||||||
foreach (var item in puserList)
|
//foreach (var item in puserList)
|
||||||
{
|
//{
|
||||||
zlName+= db.Sys_User.FirstOrDefault(x => x.UserId == item.UserId).UserName+",";
|
// zlName+= db.Sys_User.FirstOrDefault(x => x.UserId == item.UserId).UserName+",";
|
||||||
}
|
//}
|
||||||
bkmark.Text = zlName;
|
|
||||||
|
var getPUser = Funs.DB.Project_ProjectUser.Where(x => x.ProjectId == weekModel.ProjectId);
|
||||||
|
////质量经理
|
||||||
|
var qa = getPUser.FirstOrDefault(x => x.RoleId.Contains(BLL.Const.QAManager));
|
||||||
|
|
||||||
|
bkmark.Text = db.Sys_User.FirstOrDefault(x => x.UserId == qa.UserId).UserName;
|
||||||
}
|
}
|
||||||
|
|
||||||
bkmark = doc.Range.Bookmarks["reportAlldate"];
|
bkmark = doc.Range.Bookmarks["reportAlldate"];
|
||||||
|
@ -325,7 +338,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
{
|
{
|
||||||
//创建行
|
//创建行
|
||||||
Row row = new Row(doc);
|
Row row = new Row(doc);
|
||||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width,"","1"));
|
||||||
row.Cells.Add(CreateCell(item.ProStage, doc, table.FirstRow.Cells[1].CellFormat.Width));
|
row.Cells.Add(CreateCell(item.ProStage, doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||||
row.Cells.Add(CreateCell(item.ProDescribe, doc, table.FirstRow.Cells[2].CellFormat.Width));
|
row.Cells.Add(CreateCell(item.ProDescribe, doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||||
row.Cells.Add(CreateCell(item.TargetValue, doc, table.FirstRow.Cells[3].CellFormat.Width));
|
row.Cells.Add(CreateCell(item.TargetValue, doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||||
|
@ -399,7 +412,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
{
|
{
|
||||||
//创建行
|
//创建行
|
||||||
Row row = new Row(doc);
|
Row row = new Row(doc);
|
||||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width, "", "1"));
|
||||||
row.Cells.Add(CreateCell(item.UnitOrMajor, doc, table.FirstRow.Cells[1].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.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.Quantity2.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||||
|
@ -451,7 +464,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
{
|
{
|
||||||
//创建行
|
//创建行
|
||||||
Row row = new Row(doc);
|
Row row = new Row(doc);
|
||||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width, "", "1"));
|
||||||
row.Cells.Add(CreateCell(item.UnitOrMajor, doc, table.FirstRow.Cells[1].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.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.Quantity2.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||||
|
@ -507,7 +520,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
{
|
{
|
||||||
//创建行
|
//创建行
|
||||||
Row row = new Row(doc);
|
Row row = new Row(doc);
|
||||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width, "", "1"));
|
||||||
row.Cells.Add(CreateCell(item.UnitOrMajor, doc, table.FirstRow.Cells[1].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.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.Quantity2.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||||
|
@ -562,7 +575,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
{
|
{
|
||||||
//创建行
|
//创建行
|
||||||
Row row = new Row(doc);
|
Row row = new Row(doc);
|
||||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width, "", "1"));
|
||||||
row.Cells.Add(CreateCell(item.UnitOrMajor, doc, table.FirstRow.Cells[1].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.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.Quantity2.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||||
|
@ -615,7 +628,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
{
|
{
|
||||||
//创建行
|
//创建行
|
||||||
Row row = new Row(doc);
|
Row row = new Row(doc);
|
||||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width, "", "1"));
|
||||||
row.Cells.Add(CreateCell(item.UnitOrMajor, doc, table.FirstRow.Cells[1].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.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.Quantity2.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||||
|
@ -706,7 +719,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
{
|
{
|
||||||
//创建行
|
//创建行
|
||||||
Row row = new Row(doc);
|
Row row = new Row(doc);
|
||||||
row.Cells.Add(CreateCell((numberIndex-1).ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width));
|
row.Cells.Add(CreateCell((numberIndex-1).ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width, "", "1"));
|
||||||
row.Cells.Add(CreateCell(item.WorkName, doc, table.Rows[0].Cells[1].CellFormat.Width));
|
row.Cells.Add(CreateCell(item.WorkName, doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||||
row.Cells.Add(CreateCell(item.CheckNum.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
row.Cells.Add(CreateCell(item.CheckNum.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||||
row.Cells.Add(CreateCell(item.TotalCheckNum.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
row.Cells.Add(CreateCell(item.TotalCheckNum.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||||
|
@ -846,7 +859,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
{
|
{
|
||||||
//创建行
|
//创建行
|
||||||
Row row = new Row(doc);
|
Row row = new Row(doc);
|
||||||
row.Cells.Add(CreateCell((numberIndex - 1).ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width));
|
row.Cells.Add(CreateCell((numberIndex - 1).ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width, "", "1"));
|
||||||
row.Cells.Add(CreateCell(item.UnitName, doc, table.Rows[0].Cells[1].CellFormat.Width));
|
row.Cells.Add(CreateCell(item.UnitName, doc, table.Rows[0].Cells[1].CellFormat.Width));
|
||||||
|
|
||||||
row.Cells.Add(CreateCell(item.PipeMountGuard.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
row.Cells.Add(CreateCell(item.PipeMountGuard.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||||
|
@ -911,7 +924,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
{
|
{
|
||||||
//创建行
|
//创建行
|
||||||
Row row = new Row(doc);
|
Row row = new Row(doc);
|
||||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width, "", "1"));
|
||||||
row.Cells.Add(CreateCell(item.UnitOrMajor, doc, table.FirstRow.Cells[1].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.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.Quantity2.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||||
|
@ -1118,21 +1131,29 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
numberIndex = 1;
|
numberIndex = 1;
|
||||||
//需要插入的table
|
//需要插入的table
|
||||||
var Unitname = "";
|
var Unitname = "";
|
||||||
|
int pageCount = 1;
|
||||||
foreach (var item in NondestructiveTestlist)
|
foreach (var item in NondestructiveTestlist)
|
||||||
{
|
{
|
||||||
|
|
||||||
//创建行
|
//创建行
|
||||||
Row row = new Row(doc);
|
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)
|
if (numberIndex == 1 || Unitname != item.CreateMan)
|
||||||
{
|
{
|
||||||
|
if (Unitname != item.CreateMan && numberIndex != 1)
|
||||||
|
{
|
||||||
|
pageCount += 1;
|
||||||
|
}
|
||||||
|
row.Cells.Add(CreateCell((pageCount).ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width, "0", "1"));
|
||||||
row.Cells.Add(CreateCell(item.CreateMan, doc, table.Rows[0].Cells[1].CellFormat.Width, "0"));
|
row.Cells.Add(CreateCell(item.CreateMan, doc, table.Rows[0].Cells[1].CellFormat.Width, "0"));
|
||||||
|
|
||||||
Unitname = item.CreateMan;
|
Unitname = item.CreateMan;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
row.Cells.Add(CreateCell((pageCount).ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width, "1", "1"));
|
||||||
row.Cells.Add(CreateCell(item.CreateMan, doc, table.Rows[0].Cells[1].CellFormat.Width, "1"));
|
row.Cells.Add(CreateCell(item.CreateMan, doc, table.Rows[0].Cells[1].CellFormat.Width, "1"));
|
||||||
Unitname = item.CreateMan;
|
Unitname = item.CreateMan;
|
||||||
}
|
}
|
||||||
|
@ -1147,6 +1168,11 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
|
|
||||||
table.Rows.Insert(numberIndex, row);
|
table.Rows.Insert(numberIndex, row);
|
||||||
numberIndex += 1;
|
numberIndex += 1;
|
||||||
|
if (Unitname != item.CreateMan)
|
||||||
|
{
|
||||||
|
pageCount += 1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//自动设置表格样式
|
//自动设置表格样式
|
||||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||||
|
@ -1199,7 +1225,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
{
|
{
|
||||||
//创建行
|
//创建行
|
||||||
Row row = new Row(doc);
|
Row row = new Row(doc);
|
||||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width, "", "1"));
|
||||||
row.Cells.Add(CreateCell(item.UnitOrMajor, doc, table.FirstRow.Cells[1].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.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.Quantity2.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||||
|
@ -2994,6 +3020,12 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||||
//总页数
|
//总页数
|
||||||
table.Rows[4].Cells[5].FirstParagraph.Runs[0].Text = doc.PageCount.ToString();
|
table.Rows[4].Cells[5].FirstParagraph.Runs[0].Text = doc.PageCount.ToString();
|
||||||
|
|
||||||
|
bkmark = doc.Range.Bookmarks["CountPage"];
|
||||||
|
if (bkmark != null)
|
||||||
|
{
|
||||||
|
bkmark.Text = doc.PageCount.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
//页眉是第二个表
|
//页眉是第二个表
|
||||||
//tableIndex—要移动的表的索引。
|
//tableIndex—要移动的表的索引。
|
||||||
//rowIndex - 表中行的索引。
|
//rowIndex - 表中行的索引。
|
||||||
|
|
|
@ -3,8 +3,8 @@ PK
|
||||||
z5ê8v+5Ð#²œ×Æ"±-Û úï×Ù²möÊíÍŒÞhÞÜ}ö<>>hkVy9£y†FÙV›Ã*nžŠež…(M+{kp•1ä÷üú
|
z5ê8v+5Ð#²œ×Æ"±-Û úï×Ù²möÊíÍŒÞhÞÜ}ö<>>hkVy9£y†FÙV›Ã*nžŠež…(M+{kp•1ä÷üú
|
||||||
6Þ:ôQcÈ’… «¼‹ÑÝT‡ƒ³$›¤ìdLЈÝïµÂ«Þ4‘0J?#šÛÂ<C39B>
ó“ãÝGü®ikÕ˜/¼4G—shpp½ŒÈ<C388>qz g„œ4G.vâQ |