diff --git a/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReport.aspx.cs b/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReport.aspx.cs index eb6b11b9..4a3ac4df 100644 --- a/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReport.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReport.aspx.cs @@ -152,7 +152,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew * @param doc Document对象 * @return */ - public static Cell CreateCell(String value, Document doc, double cellWidth, string cellMerge = "",string CenterPage="",string cellUnitLeft="") + public static Cell CreateCell(String value, Document doc, double cellWidth, string cellMerge = "", string CenterPage = "", string cellUnitLeft = "") { Cell cell = new Cell(doc); Paragraph p = new Paragraph(doc); @@ -185,7 +185,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew { p.ParagraphFormat.Alignment = ParagraphAlignment.Center;//表格中字体居中 } - + p.AppendChild(new Run(doc, value)); @@ -194,7 +194,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew cell.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center; cell.CellFormat.Borders.LineWidth = 1.5; - + cell.AppendChild(p); return cell; } @@ -227,10 +227,10 @@ namespace FineUIPro.Web.CQMS.ManageReportNew var endDate = Convert.ToDateTime(weekModel.EndDate); //获取project var pModel = db.Base_Project.FirstOrDefault(x => x.ProjectId == weekModel.ProjectId); - var urlHz = startDate.ToString("yyyyMMdd")+"-" + var urlHz = startDate.ToString("yyyyMMdd") + "-" + endDate.ToString("yyyyMMdd"); - newUrl = uploadfilepath.Replace("项目质量月报", pModel.ShortName + "项目质量月报(第"+ weekModel.SortId + "期)"+ urlHz); + newUrl = uploadfilepath.Replace("项目质量月报", pModel.ShortName + "项目质量月报(第" + weekModel.SortId + "期)" + urlHz); if (File.Exists(newUrl)) { @@ -250,9 +250,10 @@ namespace FineUIPro.Web.CQMS.ManageReportNew orderby x.UnitName select x).FirstOrDefault(); - Bookmark bkmark = doc.Range.Bookmarks["username"]; - if (bkmark != null) { - + Bookmark bkmark = doc.Range.Bookmarks["username"]; + if (bkmark != null) + { + if (unitsYz != null) { bkmark.Text = unitsYz.UnitName; @@ -264,14 +265,14 @@ namespace FineUIPro.Web.CQMS.ManageReportNew //} } - bkmark= doc.Range.Bookmarks["projectNo"]; - if (bkmark!=null) + bkmark = doc.Range.Bookmarks["projectNo"]; + if (bkmark != null) { bkmark.Text = pModel.ProjectCode; } bkmark = doc.Range.Bookmarks["createdate"]; - if (bkmark!=null) + if (bkmark != null) { bkmark.Text = weekModel.CreateDate.ToString().Split(' ')[0].Replace('/', '.'); } @@ -283,7 +284,8 @@ namespace FineUIPro.Web.CQMS.ManageReportNew } bkmark = doc.Range.Bookmarks["quamanagername"]; - if (bkmark != null) { + if (bkmark != null) + { //var zlName = ""; ////根据项目获取质量经理 //var puserList = db.Project_ProjectUser.Where(x => x.ProjectId == weekModel.ProjectId && x.RoleId.Contains(BLL.Const.QAManager)).ToList(); @@ -307,19 +309,19 @@ namespace FineUIPro.Web.CQMS.ManageReportNew { var sdate = Convert.ToDateTime(weekModel.StartDate); var edate = Convert.ToDateTime(weekModel.EndDate); - bkmark.Text = sdate.Year+"年"+ sdate.Month +"月"+ sdate.Day+"日至"+ + bkmark.Text = sdate.Year + "年" + sdate.Month + "月" + sdate.Day + "日至" + edate.Year + "年" + edate.Month + "月" + edate.Day + "日"; } bkmark = doc.Range.Bookmarks["reportindex"]; - if (bkmark!=null) + if (bkmark != null) { bkmark.Text = weekModel.SortId; } bkmark = doc.Range.Bookmarks["fromcode"]; //fromcode,项目号-RM-PQM-顺序号 - if (bkmark!=null) + if (bkmark != null) { bkmark.Text = pModel.ProjectCode + "-RM-PQM-" + weekModel.SortId; } @@ -333,12 +335,13 @@ namespace FineUIPro.Web.CQMS.ManageReportNew //跳过页眉的表头 while (isYm) { - if (table.Range.Text.Substring(0, 2)!="序号") + if (table.Range.Text.Substring(0, 2) != "序号") { whileIndex += 1; table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true); } - else{ + else + { isYm = false; } } @@ -348,14 +351,14 @@ namespace FineUIPro.Web.CQMS.ManageReportNew { //创建行 Row row = new Row(doc); - 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,"","", "unit")); + 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, "", "", "unit")); row.Cells.Add(CreateCell(item.ProDescribe, doc, table.FirstRow.Cells[2].CellFormat.Width, "", "", "unit")); row.Cells.Add(CreateCell(item.TargetValue, doc, table.FirstRow.Cells[3].CellFormat.Width)); row.Cells.Add(CreateCell(item.MonthPer, doc, table.FirstRow.Cells[4].CellFormat.Width)); row.Cells.Add(CreateCell(item.Remarks, doc, table.FirstRow.Cells[5].CellFormat.Width, "", "", "unit")); - - table.Rows.Insert(numberIndex, row); + + table.Rows.Insert(numberIndex, row); numberIndex += 1; } //自动设置表格样式 @@ -368,7 +371,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew bkmark = doc.Range.Bookmarks["Content1"]; if (bkmark != null) { - bkmark.Text= txtReportList.FirstOrDefault(x => x.ContentType == "0").ContentText; + bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "0").ContentText; } bkmark = doc.Range.Bookmarks["Content2"]; @@ -388,10 +391,10 @@ namespace FineUIPro.Web.CQMS.ManageReportNew { bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "8").ContentText; } - + #endregion - var ContuructionAllList = db.Report_Construction_Plan.Where(x => x.ReportId == Id).OrderBy(x=>x.UnitOrMajor).ToList(); + var ContuructionAllList = db.Report_Construction_Plan.Where(x => x.ReportId == Id).OrderBy(x => x.UnitOrMajor).ToList(); #region 3.施工方案及检验试验计划审批情况 @@ -422,7 +425,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew //创建行 Row row = new Row(doc); 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,"","","unit")); + row.Cells.Add(CreateCell(item.UnitOrMajor, doc, table.FirstRow.Cells[1].CellFormat.Width, "", "", "unit")); 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.Remarks, doc, table.FirstRow.Cells[4].CellFormat.Width, "", "", "unit")); @@ -468,7 +471,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew } } numberIndex = 1; - int? num1 = 0, num2 = 0, num3=0; + int? num1 = 0, num2 = 0, num3 = 0; foreach (var item in wdsgfaList) { //创建行 @@ -482,7 +485,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew table.Rows.Insert(numberIndex, row); num1 += item.Quantity1; num2 += item.Quantity2; - num3+= item.Quantity3; + num3 += item.Quantity3; numberIndex += 1; } //自动设置表格样式 @@ -677,9 +680,11 @@ namespace FineUIPro.Web.CQMS.ManageReportNew } } int i = 1; - var cNProfessionals = from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId + var cNProfessionals = from x in Funs.DB.Base_CNProfessional + where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && x.CNProfessionalId != BLL.Const.ComprehensiveId - orderby x.SortIndex select x; + orderby x.SortIndex + select x; foreach (var item in cNProfessionals) { //专业下所有集合 @@ -704,7 +709,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew Quantity5Sum += Convert.ToInt32(checkStatisc.OneOKRate); Quantity6Sum += Convert.ToInt32(checkStatisc.TotalOneOKRate); } - if (StatisticsList.Count>0) + if (StatisticsList.Count > 0) { isYm = true; whileIndex += 1; @@ -728,7 +733,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew { //创建行 Row row = new Row(doc); - row.Cells.Add(CreateCell((numberIndex-1).ToString(), doc, table.Rows[0].Cells[0].CellFormat.Width, "", "1")); + 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.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)); @@ -768,11 +773,11 @@ namespace FineUIPro.Web.CQMS.ManageReportNew #region 7.1合格焊工管理情况 - Quantity1Sum = 0; Quantity2Sum = 0; Quantity3Sum = 0; Quantity4Sum = 0; Quantity5Sum = 0; Quantity6Sum = 0; + Quantity1Sum = 0; Quantity2Sum = 0; Quantity3Sum = 0; Quantity4Sum = 0; Quantity5Sum = 0; Quantity6Sum = 0; int Quantity7Sum = 0, Quantity8Sum = 0; - + List PassWelderList = new List(); - + if (project != null) { if (project.StartDate != null) @@ -786,7 +791,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitType == BLL.Const.ProjectUnitType_2 orderby y.UnitCode select new { x.UnitId, y.UnitName }; - + foreach (var item in units) { @@ -844,7 +849,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew Quantity7Sum += passWelderStatisc.OtherMountGuard; Quantity8Sum += passWelderStatisc.OtherTotal; } - if (PassWelderList.Count>0) + if (PassWelderList.Count > 0) { isYm = true; whileIndex += 1; @@ -958,7 +963,8 @@ namespace FineUIPro.Web.CQMS.ManageReportNew //自动设置表格样式 table.AutoFit(AutoFitBehavior.FixedColumnWidths); } - else { + else + { isYm = true; numberIndex = 1; whileIndex += 1; @@ -1003,24 +1009,16 @@ namespace FineUIPro.Web.CQMS.ManageReportNew int? totalNum0 = 0, totalNum1 = 0;//拍片数量合计 - + endDate = endDate.AddDays(1); 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) - + && c.CreateDate >= Convert.ToDateTime(startDate) && c.CreateDate < Convert.ToDateTime(endDate) orderby c.CreateDate descending - select new - { c.CreateDate, c.ProjectId, @@ -1040,7 +1038,6 @@ namespace FineUIPro.Web.CQMS.ManageReportNew model.Id = Guid.NewGuid().ToString(); model.CreateMan = item.UnitName;//用作存储施工单位名称 model.ProfessionalName = "工艺管道"; - if (gygdModel != null) { model.MonthQuantity = gygdModel.MonthQuantity; @@ -1068,9 +1065,6 @@ namespace FineUIPro.Web.CQMS.ManageReportNew NondestructiveTestlist.Add(model); } - - - //地管 gygdModel = query.FirstOrDefault(x => x.ProfessionalName == "地管"); model = new Model.ProcessControl_NondestructiveTest_New(); @@ -1175,11 +1169,8 @@ namespace FineUIPro.Web.CQMS.ManageReportNew int pageCount = 1; foreach (var item in NondestructiveTestlist) { - //创建行 Row row = new Row(doc); - - //如果是第一列,或者 if (numberIndex == 1 || Unitname != item.CreateMan) { @@ -1189,7 +1180,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew } 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", "", "unit")); - + Unitname = item.CreateMan; } else @@ -1199,8 +1190,6 @@ namespace FineUIPro.Web.CQMS.ManageReportNew 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)); @@ -1213,7 +1202,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew { pageCount += 1; } - + } //自动设置表格样式 table.AutoFit(AutoFitBehavior.FixedColumnWidths); @@ -1233,7 +1222,8 @@ namespace FineUIPro.Web.CQMS.ManageReportNew //自动设置表格样式 table.AutoFit(AutoFitBehavior.FixedColumnWidths); } - else { + else + { isYm = true; numberIndex = 1; whileIndex += 1; @@ -1324,7 +1314,8 @@ namespace FineUIPro.Web.CQMS.ManageReportNew //自动设置表格样式 table.AutoFit(AutoFitBehavior.FixedColumnWidths); } - else { + else + { isYm = true; numberIndex = 1; whileIndex += 1; @@ -3130,7 +3121,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew { bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-1").ContentText; } - } + } bkmark = doc.Range.Bookmarks["ImageContent2"]; if (bkmark != null)