diff --git a/DataBase/版本日志/HJGLDB_DS_2025-04-29_bwj.sql b/DataBase/版本日志/HJGLDB_DS_2025-04-29_bwj.sql new file mode 100644 index 0000000..0c03214 --- /dev/null +++ b/DataBase/版本日志/HJGLDB_DS_2025-04-29_bwj.sql @@ -0,0 +1,63 @@ + + +ALTER PROCEDURE [dbo].[HJGL_sp_rpt_Repair] +( + @CH_RepairID NVARCHAR(50) +) +AS +/******Ŀ޺ίе*******/ +SELECT Repair.CH_RepairID, +Repair.ProjectId, +Repair.CH_RepairNo as CH_TrustCode, +--¼ +Unit.UnitName, --ʹõλ +Project.ProjectCode, --Ŀ +Project.ProjectName, --Ŀ +Project.ShortName, +Repair.CH_RepairNo,--ίе +Installation.InstallationCode, -- +Installation.InstallationName, +-- +--ʱ +-- +Repair.CH_ItemName,-- +(CASE IsoInfo.IsHot WHEN '1' THEN '' ELSE '' END) AS IsHot,--ȴ״̬ +IsoInfo.ISO_IsoNo,-- +NDTType.NDT_Code,--ⷽ +WeldMethod.WME_Code,--ӷ +SlopeType.JST_Code,--¿ʽ +NDTRate.NDTR_Name,-- +NDTRate.NDTR_Rate, +Repair.CH_NDTCriteria,--׼ +(CASE Repair.CH_AcceptGrade +WHEN '1' THEN '' +WHEN '2' THEN '' +WHEN '3' THEN '' +WHEN '4' THEN '' +WHEN '5' THEN '' +END) AS AcceptGrade,--ϸ񼶱 +User1.UserName AS TrustManName,--ί +User2.UserName AS AuditManName,-- +CONVERT(VARCHAR(100), Repair.RepairTrustDate, 111) AS RepairTrustDate, -- +(User1.UserName+'/'+CONVERT(VARCHAR(100), Repair.RepairTrustDate, 111)) as ManAndTrustDate, +Repair.CH_CheckUnit, +checkUnit.UnitName AS CheckUnitName +FROM HJGL_CH_Repair AS Repair +LEFT JOIN dbo.Base_Unit AS Unit ON Unit.UnitId = Repair.CH_TrustUnit +LEFT JOIN dbo.Base_Project AS Project ON Project.ProjectId = Repair.ProjectId +LEFT JOIN dbo.HJGL_PW_IsoInfo AS IsoInfo ON IsoInfo.ISO_ID = Repair.ISO_ID +LEFT JOIN dbo.Project_Installation AS Installation ON Installation.InstallationId = Repair.InstallationId +LEFT JOIN dbo.Sys_User AS User1 ON User1.UserId = Repair.CH_Tabler +LEFT JOIN dbo.Sys_User AS User2 ON User2.UserId = Repair.CH_AuditMan +LEFT JOIN dbo.HJGL_BO_Batch AS Batch ON Batch.BatchId = Repair.BatchId +LEFT JOIN dbo.HJGL_BS_NDTRate AS NDTRate ON NDTRate.NDTR_ID = Batch.NDTR_ID +LEFT JOIN dbo.HJGL_BS_SlopeType AS SlopeType ON SlopeType.JST_ID = Repair.CH_SlopeType +LEFT JOIN dbo.HJGL_BS_WeldMethod AS WeldMethod ON WeldMethod.WME_ID = Repair.CH_WeldMethod +LEFT JOIN dbo.HJGL_BS_NDTType AS NDTType ON NDTType.NDT_ID = Repair.NDT_ID +LEFT JOIN Base_Unit as checkUnit ON checkUnit.UnitId = Repair.CH_CheckUnit +WHERE Repair.CH_RepairID=@CH_RepairID + + +GO + + diff --git a/HJGL_DS/FineUIPro.Web/ContinuousPrint/CommissionRepairPrint.aspx.cs b/HJGL_DS/FineUIPro.Web/ContinuousPrint/CommissionRepairPrint.aspx.cs index 8588d85..8cd55b8 100644 --- a/HJGL_DS/FineUIPro.Web/ContinuousPrint/CommissionRepairPrint.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/ContinuousPrint/CommissionRepairPrint.aspx.cs @@ -181,11 +181,181 @@ namespace FineUIPro.Web.ContinuousPrint /// protected void btnPrint_Click(object sender, EventArgs e) { - //if (Grid2.SelectedRowIndexArray.Length <= 0) - //{ - // Alert.ShowInTop("最少选中一行!", MessageBoxIcon.Warning); - // return; - //} + if (Grid2.SelectedRowIndexArray.Length <= 0) + { + Alert.ShowInTop("最少选中一行!", MessageBoxIcon.Warning); + return; + } + + string initTemplatePath = ""; + string rootPath = Server.MapPath("~/"); + BLL.Common.FastReportService.ResetData(); + + if (Grid2.Rows.Count > 0) + { + for (int gi = 0; gi < Grid2.Rows.Count; gi++) + { + if (Grid2.SelectedRowIndexArray.Contains(gi)) + { + System.Web.UI.WebControls.HiddenField hidCH_RepairID = Grid2.Rows[gi].FindControl("hidCH_RepairID") as System.Web.UI.WebControls.HiddenField; + System.Web.UI.WebControls.HiddenField hidProjectName = Grid2.Rows[gi].FindControl("hidProjectName") as System.Web.UI.WebControls.HiddenField; + Model.HJGL_CH_Repair repair = HJGL_RepairService.GetCH_RepairByID(hidCH_RepairID.Value); + if (repair != null) + { + repair.CH_PrintDate = DateTime.Now.Date; + repair.CH_Printer = this.CurrUser.UserName; + HJGL_RepairService.PrintCH_Repair(repair); + } + + var listTitleStr = new List(); + listTitleStr.Add(new SqlParameter("@CH_RepairID", hidCH_RepairID.Value)); + SqlParameter[] titleparameter = listTitleStr.ToArray(); + var tbTitle = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_Repair", titleparameter); + + DataTable dt = new DataTable(); + dt.TableName = "MainData"; + dt.Columns.Add("ProjectName"); + dt.Columns.Add("InstallastionName"); + dt.Columns.Add("InstallatinCode"); + dt.Columns.Add("TrustUnit"); + dt.Columns.Add("TrustCode"); + dt.Columns.Add("CheckUnit"); + dt.Columns.Add("ItemName"); + dt.Columns.Add("WME_Code"); + dt.Columns.Add("IsHot"); + dt.Columns.Add("JST_Name"); + dt.Columns.Add("NDTR_Name"); + dt.Columns.Add("NDT_Code"); + dt.Columns.Add("AcceptGrade"); + dt.Columns.Add("CH_NDTCriteria"); + + DataRow[] rows = tbTitle.DefaultView.ToTable().Select(); + foreach (var row in rows) + { + var newRow = dt.NewRow(); + newRow["ProjectName"] = row["ProjectName"].ToString(); + newRow["InstallastionName"] = row["InstallationName"].ToString(); + newRow["InstallatinCode"] = row["InstallationCode"].ToString(); + newRow["TrustUnit"] = row["UnitName"].ToString(); + newRow["TrustCode"] = row["CH_TrustCode"].ToString(); + newRow["CheckUnit"] = row["CheckUnitName"].ToString(); + newRow["ItemName"] = row["CH_ItemName"].ToString(); + newRow["WME_Code"] = row["WME_Code"].ToString(); + newRow["IsHot"] = "合格"; + newRow["JST_Name"] = row["JST_Code"]; + newRow["NDTR_Name"] = row["NDTR_Name"]; + newRow["NDT_Code"] = row["NDT_Code"]; + if (row["NDT_Code"].ToString() == "PT") + { + newRow["AcceptGrade"] = "Ⅰ"; + } + else + { + int rate = Funs.GetNewIntOrZero(row["NDTR_Rate"].ToString()); + if (row["NDT_Code"].ToString() == "RT" && rate < 20) + { + newRow["AcceptGrade"] = "Ⅲ"; + } + else if (row["NDT_Code"].ToString() == "RT" && rate >= 20) + { + newRow["AcceptGrade"] = "Ⅱ"; + } + else + { + newRow["AcceptGrade"] = row["AcceptGrade"].ToString(); + } + } + if (row["NDT_Code"].ToString() == "RT") + { + newRow["CH_NDTCriteria"] = "NB/T 47013.2-2015"; + } + else if (row["NDT_Code"].ToString() == "PT") + { + newRow["CH_NDTCriteria"] = "NB/T 47013.5-2015"; + } + else if (row["NDT_Code"].ToString() == "UT") + { + newRow["CH_NDTCriteria"] = "NB/T 47013.3-2015"; + } + else if (row["NDT_Code"].ToString() == "MT") + { + newRow["CH_NDTCriteria"] = "NB/T 47013.4-2015"; + } + else if (row["NDT_Code"].ToString() == "PAUT") + { + newRow["CH_NDTCriteria"] = "NB/T 47013.15-2021"; + } + else + { + newRow["CH_NDTCriteria"] = row["CH_NDTCriteria"].ToString(); + } + dt.Rows.Add(newRow); + } + BLL.Common.FastReportService.AddFastreportTable(dt); + + var listStr = new List(); + listStr.Add(new SqlParameter("@CH_RepairID", hidCH_RepairID.Value)); + SqlParameter[] parameter = listStr.ToArray(); + var tb2 = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_RepairItem", parameter); + + DataTable dt2 = new DataTable(); + dt2.TableName = "Data"; + dt2.Columns.Add("SortNum"); + dt2.Columns.Add("IsoNo"); + dt2.Columns.Add("ISO_Number"); + dt2.Columns.Add("JointNo"); + dt2.Columns.Add("JointDesc"); + dt2.Columns.Add("Ste_Code"); + dt2.Columns.Add("WelderCode"); + dt2.Columns.Add("ISO_Name"); + + DataView dv = tb2.DefaultView;//获取表视图 + dv.Sort = "ISO_IsoNo,JOT_JointNo ASC";//按照ID倒序排序 + tb2 = dv.ToTable();//转为表 + DataRow[] rows2 = tb2.DefaultView.ToTable().Select(); + int i = 0; + foreach (var row in rows2) + { + var newRows = dt2.NewRow(); + //if (i + 1 != rows2.Count()) + //{ + newRows["SortNum"] = i + 1; + //} + newRows["IsoNo"] = row["ISO_IsoNo"].ToString(); + newRows["ISO_Number"] = row["ISO_IsoNo"].ToString(); + newRows["JointNo"] = row["JOT_JointNo"].ToString(); + newRows["JointDesc"] = row["JOT_JointDesc"].ToString(); + newRows["Ste_Code"] = row["STE_Code"].ToString(); + newRows["WelderCode"] = row["WED_Code"].ToString(); + newRows["ISO_Name"] = row["ISC_IsoName"].ToString(); + + dt2.Rows.Add(newRows); + i++; + } + BLL.Common.FastReportService.AddFastreportTable(dt2); + + string isoid = rows2[0]["ISO_ID"].ToString(); + string jotyId = rows2[0]["JOTY_ID"].ToString(); + int jointCount = BLL.HJGL_PW_JointInfoService.GetJointCountByIsoId(isoid, jotyId); + //传参 + Dictionary keyValuePairs = new Dictionary(); + keyValuePairs.Add("JointCount", jointCount.ToString()); + keyValuePairs.Add("CheckCount", (rows.Count() - 1).ToString()); + BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs); + + + } + } + initTemplatePath = "File\\Fastreport\\管道焊缝检测委托单.frx"; + + if (File.Exists(rootPath + initTemplatePath)) + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../common/ReportPrint/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); + + } + } + + #region 导出Excel,不用了 //string rootPath = Server.MapPath("~/") + Const.ExcelUrl; ////导出文件 //string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\"; @@ -201,28 +371,20 @@ namespace FineUIPro.Web.ContinuousPrint // XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("返修焊缝委托单"); // #region 列宽 - // ws.SetColumnWidth(0, (4 * 256) + 126);//3.92 - // ws.SetColumnWidth(1, 3 * 256);//2.42 - // ws.SetColumnWidth(2, (3 * 256) + 75); //2.67 - // ws.SetColumnWidth(3, 4 * 256); //3.42 - // ws.SetColumnWidth(4, (7 * 256) + 200);//7.17 - // ws.SetColumnWidth(5, (4 * 256) + 145);//4 - // ws.SetColumnWidth(6, (5 * 256) + 15);//4.5 - // ws.SetColumnWidth(7, (6 * 256) + 126);//5.92 - // ws.SetColumnWidth(8, (8 * 256) + 145);//8 - // ws.SetColumnWidth(9, (3 * 256) + 200);//3.17 - // ws.SetColumnWidth(10, (2 * 256) + 75);//1.67 - // ws.SetColumnWidth(11, 250);//0.63 - // ws.SetColumnWidth(12, (7 * 256) + 126);//6.92 - // ws.SetColumnWidth(13, (5 * 256) - 50);//4.25 - // ws.SetColumnWidth(14, (6 * 256) + 15);//5.5 - // ws.SetColumnWidth(15, (14 * 256) - 50);//13.25 + // ws.SetColumnWidth(0, 5 * 256 + 164);//5 + // ws.SetColumnWidth(1, 5 * 256);//4.36 + // ws.SetColumnWidth(2, 12 * 256); //11.36 + // ws.SetColumnWidth(3, 2 * 256); //1.36 + // ws.SetColumnWidth(4, 12 * 256);//11.36 + // ws.SetColumnWidth(5, 6 * 256);//5.36 + // ws.SetColumnWidth(6, 5 * 256);//4.36 + // ws.SetColumnWidth(7, 10 * 256);//9.36 + // ws.SetColumnWidth(8, 5 * 256);//4.36 + // ws.SetColumnWidth(9, 8 * 256);//7.36 + // ws.SetColumnWidth(10, 10 * 256);//9.36 + // ws.SetColumnWidth(11, 10 * 256);//9.36 // #endregion - // //图片地址 - // byte[] bytes = File.ReadAllBytes(Server.MapPath("~/") + "Images\\PrintLog.png"); - // int pictureIdx = hssfworkbook.AddPicture(bytes, PictureType.JPEG); - // for (int gi = 0; gi < Grid2.Rows.Count; gi++) // { // if (Grid2.SelectedRowIndexArray.Contains(gi)) @@ -248,16 +410,16 @@ namespace FineUIPro.Web.ContinuousPrint // var tbTitle = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_Repair", titleparameter); // if (tb.Rows.Count > 0 && tbTitle.Rows.Count > 0) // { - // var allPageNum = Math.Ceiling((float)tb.Rows.Count / 20); - // var titIsXu = 30; - + // var allPageNum = Math.Ceiling((float)tb.Rows.Count / 15); + // var titIsXu = 26; // for (int i = 1; i <= allPageNum; i++) // { - // //公共样式 // ICellStyle style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true); // //有边框文字居左 // ICellStyle leftstyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true); + // //有边框文字居中 + // ICellStyle centerstyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 12, true); // //底部双底虚线 // ICellStyle doubleLinestyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Double, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true); // //无边框文字靠左 @@ -266,275 +428,411 @@ namespace FineUIPro.Web.ContinuousPrint // ICellStyle rightNoneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10, true); // //头部样式 // ICellStyle titleStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 11, true, true, "黑体"); - // ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, int.Parse((rowIndex + titIsXu).ToString()), style, 0, 15); - + // ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, int.Parse((rowIndex + titIsXu).ToString()), style, 0, 11);//表格列数 // #region 头部 - // //行0 - // CellRangeAddress region = new CellRangeAddress(rowIndex, rowIndex, 0, 4); + // CellRangeAddress region = new CellRangeAddress(rowIndex, rowIndex + 1, 0, 2); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex).GetCell(0).SetCellValue("文件版本:1"); - // ws.GetRow(rowIndex).GetCell(0).CellStyle = leftNoneStyle; + // ws.GetRow(rowIndex).GetCell(0).SetCellValue("浙江石油化工有限公司"); + // ws.GetRow(rowIndex).GetCell(0).CellStyle = centerstyle; + // ws.GetRow(rowIndex).GetCell(1).CellStyle = centerstyle; + // ws.GetRow(rowIndex).GetCell(2).CellStyle = centerstyle; - // region = new CellRangeAddress(rowIndex, rowIndex, 14, 15); + // region = new CellRangeAddress(rowIndex, rowIndex + 1, 3, 7); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex).GetCell(14).SetCellValue("保管期限:5年"); - // ws.GetRow(rowIndex).GetCell(14).CellStyle = rightNoneStyle; + // ws.GetRow(rowIndex).GetCell(3).SetCellValue("管道焊缝返修检测委托单"); + // ws.GetRow(rowIndex).GetCell(3).CellStyle = titleStyle; + // ws.GetRow(rowIndex).GetCell(4).CellStyle = titleStyle; + // ws.GetRow(rowIndex).GetCell(5).CellStyle = titleStyle; + // ws.GetRow(rowIndex).GetCell(6).CellStyle = titleStyle; + // ws.GetRow(rowIndex).GetCell(7).CellStyle = titleStyle; + + // region = new CellRangeAddress(rowIndex, rowIndex, 8, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(8).SetCellValue("工程名称:" + tbTitle.Rows[0]["ProjectName"].ToString()); + // ws.GetRow(rowIndex).GetCell(8).CellStyle = leftstyle; + // ws.GetRow(rowIndex).GetCell(9).CellStyle = leftstyle; + // ws.GetRow(rowIndex).GetCell(10).CellStyle = leftstyle; + // ws.GetRow(rowIndex).GetCell(11).CellStyle = leftstyle; // //行1 - // region = new CellRangeAddress(rowIndex + 1, rowIndex + 3, 0, 3); + // region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 8, 11); // ws.AddMergedRegion(region); - // IDrawing patriarch = ws.CreateDrawingPatriarch(); - // IClientAnchor anchor = patriarch.CreateAnchor(0, 0, 0, 0, 0, rowIndex + 1, 4, rowIndex + 4); - // IPicture pict = patriarch.CreatePicture(anchor, pictureIdx); - // //pict.Resize(); - - // region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 4, 15); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 1).GetCell(4).SetCellValue("中国石油化工股份有限公司镇海炼化分公司管理体系"); + // ws.GetRow(rowIndex + 1).GetCell(8).SetCellValue("单位工程名称:管道安装"); + // ws.GetRow(rowIndex + 1).GetCell(8).CellStyle = leftstyle; // //行2 - // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 4, 15); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 1); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue("项目管理部焊缝检测委托单"); - // ws.GetRow(rowIndex + 2).GetCell(4).CellStyle = titleStyle; + // ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("装置名称"); + + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 2, 5); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue(tbTitle.Rows[0]["InstallationName"].ToString()); + + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 6, 7); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("装置主项号"); + + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue(tbTitle.Rows[0]["InstallationCode"].ToString()); // //行3 - // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 4, 5); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("记录编号"); + // ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("委托单位"); - // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 6, 9); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 5); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("PMT-T10.326.06.040.2016"); + // ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue(tbTitle.Rows[0]["UnitName"].ToString()); - // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 10, 12); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 6, 7); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 3).GetCell(10).SetCellValue("使用单位"); + // ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("委托单编号"); - // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 13, 15); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 8, 11); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 3).GetCell(13).SetCellValue(tbTitle.Rows[0]["UnitName"].ToString()); + // ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue(tbTitle.Rows[0]["CH_TrustCode"].ToString()); // //行4 - // region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 2); + // region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("项目号"); + // ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("承包商"); - // region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 3, 5); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 4).GetCell(3).SetCellValue(tbTitle.Rows[0]["ProjectCode"].ToString()); + // ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue("鼎盛石化工程有限公司"); - // region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 6, 7); + // region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 3, 4); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 4).GetCell(6).SetCellValue("项目名称"); + // ws.GetRow(rowIndex + 4).GetCell(3).SetCellValue("检测单位"); - // region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 8, 12); + // region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 6); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 4).GetCell(8).SetCellValue(tbTitle.Rows[0]["ProjectName"].ToString()); - // ws.GetRow(rowIndex + 4).GetCell(8).CellStyle = leftstyle; + // ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue(tbTitle.Rows[0]["CheckUnitName"].ToString()); - // region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 13, 14); + // ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("检件名称"); + + // region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 8, 9); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 4).GetCell(13).SetCellValue("委托单编号"); - // ws.GetRow(rowIndex + 4).GetCell(15).SetCellValue(tbTitle.Rows[0]["CH_RepairNo"].ToString()); + // ws.GetRow(rowIndex + 4).GetCell(8).SetCellValue("工业管道"); + + // ws.GetRow(rowIndex + 4).GetCell(10).SetCellValue("外观检查"); + + // ws.GetRow(rowIndex + 4).GetCell(11).SetCellValue("合格"); // //行5 - // region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 0, 2); + // region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 0, 1); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("区域号"); + // ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("焊接方法"); - // region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 3, 5); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 5).GetCell(3).SetCellValue(tbTitle.Rows[0]["WorkAreaCode"].ToString()); + // ws.GetRow(rowIndex + 5).GetCell(2).SetCellValue(tbTitle.Rows[0]["WME_Code"].ToString()); - // region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 6, 7); + // region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 3, 4); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 5).GetCell(6).SetCellValue("分项工程"); + // ws.GetRow(rowIndex + 5).GetCell(3).SetCellValue("热处理状态"); - // region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 8, 12); + // region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 5, 6); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue(""); + // ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue(tbTitle.Rows[0]["IsHot"].ToString()); - // region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 13, 14); + // ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("坡口形式"); + + // region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 8, 9); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 5).GetCell(13).SetCellValue("检测时机"); - // ws.GetRow(rowIndex + 5).GetCell(15).SetCellValue(""); + // ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue(tbTitle.Rows[0]["JST_Code"].ToString()); + + // ws.GetRow(rowIndex + 5).GetCell(10).SetCellValue("检测比例"); + + // ws.GetRow(rowIndex + 5).GetCell(11).SetCellValue(tbTitle.Rows[0]["NDTR_Name"].ToString()); // //行6 - // region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 0, 2); + // region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 0, 1); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("检件编号"); + // ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("检测方法"); - // region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 3, 5); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 6).GetCell(3).SetCellValue(tbTitle.Rows[0]["ISO_IsoNo"].ToString()); + // ws.GetRow(rowIndex + 6).GetCell(2).SetCellValue(tbTitle.Rows[0]["NDT_Code"].ToString()); - // region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 6, 7); + // region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 3, 4); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 6).GetCell(6).SetCellValue("检件名称"); + // ws.GetRow(rowIndex + 6).GetCell(3).SetCellValue("检测时机"); - // region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 8, 12); + // region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 6); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 6).GetCell(8).SetCellValue(tbTitle.Rows[0]["CH_ItemName"].ToString()); + // ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue("焊后"); - // region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 13, 14); + // ws.GetRow(rowIndex + 6).GetCell(7).SetCellValue("技术等级"); + + // region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 8, 9); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 6).GetCell(13).SetCellValue("热处理状态"); - // ws.GetRow(rowIndex + 6).GetCell(15).SetCellValue(tbTitle.Rows[0]["IsHot"].ToString()); + // ws.GetRow(rowIndex + 6).GetCell(8).SetCellValue("AB级"); + + // ws.GetRow(rowIndex + 6).GetCell(10).SetCellValue("合格级别"); + + // ws.GetRow(rowIndex + 6).GetCell(11).SetCellValue(tbTitle.Rows[0]["AcceptGrade"].ToString()); // //行7 - // region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 0, 2); + // region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 0, 1); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("检测方法"); + // ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("检测标准"); - // region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 3, 5); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 7).GetCell(3).SetCellValue(tbTitle.Rows[0]["NDT_Code"].ToString()); + // ws.GetRow(rowIndex + 7).GetCell(2).SetCellValue(tbTitle.Rows[0]["CH_NDTCriteria"].ToString()); - // region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 6, 7); + // region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 3, 4); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 7).GetCell(6).SetCellValue("焊接方法"); + // ws.GetRow(rowIndex + 7).GetCell(3).SetCellValue("检测部位"); - // region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 8, 12); + // region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 5, 6); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 7).GetCell(8).SetCellValue(tbTitle.Rows[0]["WME_Code"].ToString()); + // ws.GetRow(rowIndex + 7).GetCell(5).SetCellValue("焊缝"); - // region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 13, 14); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 7).GetCell(13).SetCellValue("坡口形式"); - // ws.GetRow(rowIndex + 7).GetCell(15).SetCellValue(tbTitle.Rows[0]["JST_Code"].ToString()); + // ws.GetRow(rowIndex + 7).GetCell(7).SetCellValue("焊口总数"); - // //行8 - // region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 0, 2); + // region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 8, 9); // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 8).GetCell(0).SetCellValue("检测比例"); + // string isoid = tb.Rows[0]["ISO_ID"].ToString(); + // string jotyId = tb.Rows[0]["JOTY_ID"].ToString(); + // int jointCount = BLL.HJGL_PW_JointInfoService.GetJointCountByIsoId(isoid, jotyId); + // ws.GetRow(rowIndex + 7).GetCell(8).SetCellValue(jointCount.ToString()); - // region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 3, 5); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 8).GetCell(3).SetCellValue(tbTitle.Rows[0]["NDTR_Name"].ToString()); - - // region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 6, 7); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 8).GetCell(6).SetCellValue("检测标准"); - - // region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 8, 12); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 8).GetCell(8).SetCellValue(tbTitle.Rows[0]["CH_NDTCriteria"].ToString()); - - // region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 13, 14); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 8).GetCell(13).SetCellValue("合格级别"); - // ws.GetRow(rowIndex + 8).GetCell(15).SetCellValue(tbTitle.Rows[0]["AcceptGrade"].ToString()); - - // //行9 - // region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 0, 1); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 9).GetCell(0).SetCellValue("委托人"); - // ws.GetRow(rowIndex + 9).GetCell(0).CellStyle = ws.GetRow(rowIndex + 9).GetCell(1).CellStyle = doubleLinestyle; - - // region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 2, 4); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 9).GetCell(2).SetCellValue(tbTitle.Rows[0]["TrustManName"].ToString()); - // ws.GetRow(rowIndex + 9).GetCell(2).CellStyle = ws.GetRow(rowIndex + 9).GetCell(3).CellStyle = ws.GetRow(rowIndex + 9).GetCell(4).CellStyle = doubleLinestyle; - - // region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 5, 6); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 9).GetCell(5).SetCellValue("审核人"); - // ws.GetRow(rowIndex + 9).GetCell(5).CellStyle = ws.GetRow(rowIndex + 9).GetCell(6).CellStyle = doubleLinestyle; - - // region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 7, 8); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 9).GetCell(7).SetCellValue(tbTitle.Rows[0]["AuditManName"].ToString()); - // ws.GetRow(rowIndex + 9).GetCell(7).CellStyle = ws.GetRow(rowIndex + 9).GetCell(8).CellStyle = doubleLinestyle; - - // region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 9, 11); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 9).GetCell(9).SetCellValue("接收人"); - // ws.GetRow(rowIndex + 9).GetCell(9).CellStyle = ws.GetRow(rowIndex + 9).GetCell(10).CellStyle = ws.GetRow(rowIndex + 9).GetCell(11).CellStyle = doubleLinestyle; - - // region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 12, 13); - // ws.AddMergedRegion(region); - // ws.GetRow(rowIndex + 9).GetCell(12).SetCellValue(""); - // ws.GetRow(rowIndex + 9).GetCell(14).SetCellValue("日期"); - // ws.GetRow(rowIndex + 9).GetCell(15).SetCellValue(tbTitle.Rows[0]["RepairTrustDate"].ToString()); - // ws.GetRow(rowIndex + 9).GetCell(12).CellStyle = ws.GetRow(rowIndex + 9).GetCell(13).CellStyle = ws.GetRow(rowIndex + 9).GetCell(14).CellStyle = ws.GetRow(rowIndex + 9).GetCell(15).CellStyle = doubleLinestyle; + // ws.GetRow(rowIndex + 7).GetCell(10).SetCellValue("检测数量"); + // ws.GetRow(rowIndex + 7).GetCell(11).SetCellValue((tb.Rows.Count-1).ToString()); // #endregion // #region 表格 - // var dataTit = rowIndex + 10; + // var dataTit = rowIndex + 8; // //合并单元格 // for (int hb = dataTit; hb <= rowIndex + titIsXu; hb++) // { // region = new CellRangeAddress(hb, hb, 1, 3); // ws.AddMergedRegion(region); - // region = new CellRangeAddress(hb, hb, 4, 5); - // ws.AddMergedRegion(region); - // region = new CellRangeAddress(hb, hb, 6, 7); + // region = new CellRangeAddress(hb, hb, 5, 6); // ws.AddMergedRegion(region); // region = new CellRangeAddress(hb, hb, 8, 9); // ws.AddMergedRegion(region); - // region = new CellRangeAddress(hb, hb, 10, 12); - // ws.AddMergedRegion(region); - // region = new CellRangeAddress(hb, hb, 13, 14); - // ws.AddMergedRegion(region); // } // //每页数据开始和结束条数 - // var dStart = i == 1 ? 0 : (i - 1) * 20; - // var dEnd = i * 20; + // var dStart = i == 1 ? 0 : (i - 1) * 16; + // var dEnd = i * 16; // //获取当前页数据 // var pageTb = GetPageToTable(tb, dStart, dEnd); + // //列头 // ws.GetRow(dataTit).GetCell(0).SetCellValue("序号"); - // ws.GetRow(dataTit).GetCell(1).SetCellValue("检测批号"); - // ws.GetRow(dataTit).GetCell(4).SetCellValue("检件编号"); - // ws.GetRow(dataTit).GetCell(6).SetCellValue("焊缝编号"); - // ws.GetRow(dataTit).GetCell(8).SetCellValue("焊工号"); - // ws.GetRow(dataTit).GetCell(10).SetCellValue("焊缝规格"); - // ws.GetRow(dataTit).GetCell(13).SetCellValue("材质"); - // ws.GetRow(dataTit).GetCell(15).SetCellValue("备注"); + // ws.GetRow(dataTit).GetCell(1).SetCellValue("管线编号"); + // ws.GetRow(dataTit).GetCell(4).SetCellValue("单线号"); + // ws.GetRow(dataTit).GetCell(5).SetCellValue("焊口编号"); + // ws.GetRow(dataTit).GetCell(7).SetCellValue("焊口规格"); + // ws.GetRow(dataTit).GetCell(8).SetCellValue("材质"); + // ws.GetRow(dataTit).GetCell(10).SetCellValue("焊工号"); + // ws.GetRow(dataTit).GetCell(11).SetCellValue("管道等级"); // //数据 // for (int j = 0; j < pageTb.Rows.Count; j++) // { // int dataIndex = dataTit + j + 1; // ws.GetRow(dataIndex).GetCell(0).SetCellValue(pageTb.Rows[j]["Number"].ToString()); - // ws.GetRow(dataIndex).GetCell(1).SetCellValue(pageTb.Rows[j]["BatchCode"].ToString()); + // ws.GetRow(dataIndex).GetCell(1).SetCellValue(pageTb.Rows[j]["ISO_IsoNo"].ToString()); // ws.GetRow(dataIndex).GetCell(4).SetCellValue(pageTb.Rows[j]["ISO_IsoNo"].ToString()); - // ws.GetRow(dataIndex).GetCell(6).SetCellValue(pageTb.Rows[j]["JOT_JointNo"].ToString()); - // ws.GetRow(dataIndex).GetCell(8).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString()); - // ws.GetRow(dataIndex).GetCell(10).SetCellValue(pageTb.Rows[j]["JOT_JointDesc"].ToString()); - // ws.GetRow(dataIndex).GetCell(13).SetCellValue(pageTb.Rows[j]["STE_Code"].ToString()); - // ws.GetRow(dataIndex).GetCell(15).SetCellValue(pageTb.Rows[j]["CH_Remark"].ToString()); + // ws.GetRow(dataIndex).GetCell(5).SetCellValue(pageTb.Rows[j]["JOT_JointNo"].ToString()); + // ws.GetRow(dataIndex).GetCell(7).SetCellValue(pageTb.Rows[j]["JOT_JointDesc"].ToString()); + // ws.GetRow(dataIndex).GetCell(8).SetCellValue(pageTb.Rows[j]["STE_Code"].ToString()); + // ws.GetRow(dataIndex).GetCell(10).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString()); + // ws.GetRow(dataIndex).GetCell(11).SetCellValue(pageTb.Rows[j]["ISC_IsoName"].ToString()); // } // #endregion // #region 尾部 - - // //尾部样式 + // //尾部样式无线条 // ICellStyle noneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10); - // //创建尾部行 // var tEnd = int.Parse((rowIndex + titIsXu + 1).ToString()); + // ////创建尾部 // ws.CreateRow(tEnd); // ws.CreateRow(tEnd).HeightInPoints = 21f; - // //创建尾部列 - // for (int eIndex = 0; eIndex <= 15; eIndex++) + // ws.CreateRow(tEnd + 1); + // ws.CreateRow(tEnd + 1).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 2); + // ws.CreateRow(tEnd + 2).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 3); + // ws.CreateRow(tEnd + 3).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 4); + // ws.CreateRow(tEnd + 4).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 5); + // ws.CreateRow(tEnd + 5).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 6); + // ws.CreateRow(tEnd + 6).HeightInPoints = 21f; + + // for (int eIndex = 0; eIndex <= 12; eIndex++) // { // ws.GetRow(tEnd).CreateCell(eIndex); // ws.GetRow(tEnd).GetCell(eIndex).CellStyle = noneStyle; + // //行1 + // ws.GetRow(tEnd + 1).CreateCell(eIndex); + // ws.GetRow(tEnd + 1).GetCell(eIndex).CellStyle = noneStyle; + // //行2 + // ws.GetRow(tEnd + 2).CreateCell(eIndex); + // ws.GetRow(tEnd + 2).GetCell(eIndex).CellStyle = noneStyle; + // //行3 + // ws.GetRow(tEnd + 3).CreateCell(eIndex); + // ws.GetRow(tEnd + 3).GetCell(eIndex).CellStyle = noneStyle; + // //行4 + // ws.GetRow(tEnd + 4).CreateCell(eIndex); + // ws.GetRow(tEnd + 4).GetCell(eIndex).CellStyle = noneStyle; + // //行5 + // ws.GetRow(tEnd + 5).CreateCell(eIndex); + // ws.GetRow(tEnd + 5).GetCell(eIndex).CellStyle = noneStyle; + // //行6 + // ws.GetRow(tEnd + 6).CreateCell(eIndex); + // ws.GetRow(tEnd + 6).GetCell(eIndex).CellStyle = noneStyle; // } - // region = new CellRangeAddress(tEnd, tEnd, 14, 15); + + // //尾部样式左侧线条文字靠左 + // ICellStyle leftStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + // //尾部样式右侧线条文字靠左 + // ICellStyle rightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + // //尾部样式上、下、左侧线文字居中 + // ICellStyle topBottomLeftStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10); + // //上、下线文字靠左 + // ICellStyle topBottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + // //上、下、右侧线文字靠左 + // ICellStyle topBottomRightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + // //左、下线文字居左 + // ICellStyle leftBottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + // //下线文字靠左 + // ICellStyle bottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + // //下、右侧线文字靠左 + // ICellStyle bottomRightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + + // //尾部行1 + // region = new CellRangeAddress(tEnd, tEnd, 0, 11); // ws.AddMergedRegion(region); - // ws.GetRow(tEnd).GetCell(14).SetCellValue(string.Format("第 {0} 页 共 {1} 页", i, allPageNum)); + // ws.GetRow(tEnd).GetCell(0).SetCellValue("注:"); + // ws.GetRow(tEnd).GetCell(0).CellStyle = leftStyle; + // ws.GetRow(tEnd).GetCell(11).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 1, tEnd + 1, 0, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 1).GetCell(0).SetCellValue("1、附图 张;"); + // ws.GetRow(tEnd + 1).GetCell(0).CellStyle = leftStyle; + // ws.GetRow(tEnd + 1).GetCell(11).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 2, tEnd + 2, 0, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 2).GetCell(0).SetCellValue("2、需要说明的其他问题:"); + // ws.GetRow(tEnd + 2).GetCell(0).CellStyle = leftStyle; + // ws.GetRow(tEnd + 2).GetCell(11).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 3, tEnd + 3, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 3).GetCell(0).SetCellValue("承包商"); + // ws.GetRow(tEnd + 3).GetCell(0).CellStyle = topBottomLeftStyle; + // ws.GetRow(tEnd + 3).GetCell(1).CellStyle = topBottomStyle; + // ws.GetRow(tEnd + 3).GetCell(2).CellStyle = topBottomRightStyle; + + // region = new CellRangeAddress(tEnd + 3, tEnd + 3, 3, 5); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 3).GetCell(3).SetCellValue("监理单位"); + // ws.GetRow(tEnd + 3).GetCell(3).CellStyle = topBottomLeftStyle; + // ws.GetRow(tEnd + 3).GetCell(4).CellStyle = topBottomStyle; + // ws.GetRow(tEnd + 3).GetCell(5).CellStyle = topBottomRightStyle; + + // region = new CellRangeAddress(tEnd + 3, tEnd + 3, 6, 8); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 3).GetCell(6).SetCellValue("项目部"); + // ws.GetRow(tEnd + 3).GetCell(6).CellStyle = topBottomLeftStyle; + // ws.GetRow(tEnd + 3).GetCell(7).CellStyle = topBottomStyle; + // ws.GetRow(tEnd + 3).GetCell(8).CellStyle = topBottomRightStyle; + + // region = new CellRangeAddress(tEnd + 3, tEnd + 3, 9, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 3).GetCell(9).SetCellValue("检测单位"); + // ws.GetRow(tEnd + 3).GetCell(9).CellStyle = topBottomLeftStyle; + // ws.GetRow(tEnd + 3).GetCell(10).CellStyle = topBottomStyle; + // ws.GetRow(tEnd + 3).GetCell(11).CellStyle = topBottomRightStyle; + + // region = new CellRangeAddress(tEnd + 4, tEnd + 4, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 4).GetCell(0).SetCellValue(""); + // ws.GetRow(tEnd + 4).GetCell(0).CellStyle = leftStyle; + // ws.GetRow(tEnd + 4).GetCell(2).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 4, tEnd + 4, 3, 5); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 4).GetCell(3).SetCellValue(""); + // ws.GetRow(tEnd + 4).GetCell(3).CellStyle = leftStyle; + // ws.GetRow(tEnd + 4).GetCell(5).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 4, tEnd + 4, 6, 8); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 4).GetCell(6).SetCellValue(""); + // ws.GetRow(tEnd + 4).GetCell(6).CellStyle = leftStyle; + // ws.GetRow(tEnd + 4).GetCell(8).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 4, tEnd + 4, 9, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 4).GetCell(9).SetCellValue(""); + // ws.GetRow(tEnd + 4).GetCell(9).CellStyle = leftStyle; + // ws.GetRow(tEnd + 4).GetCell(11).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 5, tEnd + 5, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 5).GetCell(0).SetCellValue("签字:"); + // ws.GetRow(tEnd + 5).GetCell(0).CellStyle = leftStyle; + // ws.GetRow(tEnd + 5).GetCell(2).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 5, tEnd + 5, 3, 5); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 5).GetCell(3).SetCellValue("签字:"); + // ws.GetRow(tEnd + 5).GetCell(3).CellStyle = leftStyle; + // ws.GetRow(tEnd + 5).GetCell(5).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 5, tEnd + 5, 6, 8); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 5).GetCell(6).SetCellValue("签字:"); + // ws.GetRow(tEnd + 5).GetCell(6).CellStyle = leftStyle; + // ws.GetRow(tEnd + 5).GetCell(8).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 5, tEnd + 5, 9, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 5).GetCell(9).SetCellValue("签字:"); + // ws.GetRow(tEnd + 5).GetCell(9).CellStyle = leftStyle; + // ws.GetRow(tEnd + 5).GetCell(11).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 6, tEnd + 6, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 6).GetCell(0).SetCellValue("日期:"); + // ws.GetRow(tEnd + 6).GetCell(0).CellStyle = leftBottomStyle; + // ws.GetRow(tEnd + 6).GetCell(1).CellStyle = bottomStyle; + // ws.GetRow(tEnd + 6).GetCell(2).CellStyle = bottomRightStyle; + + // region = new CellRangeAddress(tEnd + 6, tEnd + 6, 3, 5); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 6).GetCell(3).SetCellValue("日期:"); + // ws.GetRow(tEnd + 6).GetCell(3).CellStyle = leftBottomStyle; + // ws.GetRow(tEnd + 6).GetCell(4).CellStyle = bottomStyle; + // ws.GetRow(tEnd + 6).GetCell(5).CellStyle = bottomRightStyle; + + // region = new CellRangeAddress(tEnd + 6, tEnd + 6, 6, 8); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 6).GetCell(6).SetCellValue("日期:"); + // ws.GetRow(tEnd + 6).GetCell(6).CellStyle = leftBottomStyle; + // ws.GetRow(tEnd + 6).GetCell(7).CellStyle = bottomStyle; + // ws.GetRow(tEnd + 6).GetCell(8).CellStyle = bottomRightStyle; + + // region = new CellRangeAddress(tEnd + 6, tEnd + 6, 9, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 6).GetCell(9).SetCellValue("日期:"); + // ws.GetRow(tEnd + 6).GetCell(9).CellStyle = leftBottomStyle; + // ws.GetRow(tEnd + 6).GetCell(10).CellStyle = bottomStyle; + // ws.GetRow(tEnd + 6).GetCell(11).CellStyle = bottomRightStyle; // #endregion - // rowIndex += int.Parse((titIsXu + 2).ToString()); + // rowIndex += int.Parse((titIsXu + 8).ToString()); // } // } // } @@ -543,11 +841,6 @@ namespace FineUIPro.Web.ContinuousPrint // ws.SetMargin(MarginType.LeftMargin, 0.7); // ws.SetMargin(MarginType.RightMargin, 0.5); - // //ws.SetMargin(MarginType.BottomMargin, 1); - // //ws.SetMargin(MarginType.TopMargin, 1); - // //ws.SetMargin(MarginType.FooterMargin, 0.5); - // //ws.SetMargin(MarginType.HeaderMargin, 0.5); - // ws.PrintSetup.Landscape = false; // ws.PrintSetup.PaperSize = 9; @@ -571,520 +864,7 @@ namespace FineUIPro.Web.ContinuousPrint // // 停止页面的执行 // Response.End(); //} - - if (Grid2.SelectedRowIndexArray.Length <= 0) - { - Alert.ShowInTop("最少选中一行!", MessageBoxIcon.Warning); - return; - } - string rootPath = Server.MapPath("~/") + Const.ExcelUrl; - //导出文件 - string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\"; - if (!Directory.Exists(filePath)) - { - Directory.CreateDirectory(filePath); - } - string ReportFileName = filePath + "out1.xlsx"; - if (Grid2.Rows.Count > 0) - { - int rowIndex = 0; - XSSFWorkbook hssfworkbook = new XSSFWorkbook(); - XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("返修焊缝委托单"); - - #region 列宽 - ws.SetColumnWidth(0, 5 * 256 + 164);//5 - ws.SetColumnWidth(1, 5 * 256);//4.36 - ws.SetColumnWidth(2, 12 * 256); //11.36 - ws.SetColumnWidth(3, 2 * 256); //1.36 - ws.SetColumnWidth(4, 12 * 256);//11.36 - ws.SetColumnWidth(5, 6 * 256);//5.36 - ws.SetColumnWidth(6, 5 * 256);//4.36 - ws.SetColumnWidth(7, 10 * 256);//9.36 - ws.SetColumnWidth(8, 5 * 256);//4.36 - ws.SetColumnWidth(9, 8 * 256);//7.36 - ws.SetColumnWidth(10, 10 * 256);//9.36 - ws.SetColumnWidth(11, 10 * 256);//9.36 - #endregion - - for (int gi = 0; gi < Grid2.Rows.Count; gi++) - { - if (Grid2.SelectedRowIndexArray.Contains(gi)) - { - System.Web.UI.WebControls.HiddenField hidCH_RepairID = Grid2.Rows[gi].FindControl("hidCH_RepairID") as System.Web.UI.WebControls.HiddenField; - System.Web.UI.WebControls.HiddenField hidProjectName = Grid2.Rows[gi].FindControl("hidProjectName") as System.Web.UI.WebControls.HiddenField; - Model.HJGL_CH_Repair repair = HJGL_RepairService.GetCH_RepairByID(hidCH_RepairID.Value); - if (repair != null) - { - repair.CH_PrintDate = DateTime.Now.Date; - repair.CH_Printer = this.CurrUser.UserName; - HJGL_RepairService.PrintCH_Repair(repair); - } - //列表 - var listStr = new List(); - listStr.Add(new SqlParameter("@CH_RepairID", hidCH_RepairID.Value)); - SqlParameter[] parameter = listStr.ToArray(); - var tb = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_RepairItem", parameter); - //头部 - var listTitleStr = new List(); - listTitleStr.Add(new SqlParameter("@CH_RepairID", hidCH_RepairID.Value)); - SqlParameter[] titleparameter = listTitleStr.ToArray(); - var tbTitle = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_Repair", titleparameter); - if (tb.Rows.Count > 0 && tbTitle.Rows.Count > 0) - { - var allPageNum = Math.Ceiling((float)tb.Rows.Count / 15); - var titIsXu = 26; - for (int i = 1; i <= allPageNum; i++) - { - //公共样式 - ICellStyle style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true); - //有边框文字居左 - ICellStyle leftstyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true); - //有边框文字居中 - ICellStyle centerstyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 12, true); - //底部双底虚线 - ICellStyle doubleLinestyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Double, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true); - //无边框文字靠左 - ICellStyle leftNoneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true); - //无边框文字靠右 - ICellStyle rightNoneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10, true); - //头部样式 - ICellStyle titleStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 11, true, true, "黑体"); - ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, int.Parse((rowIndex + titIsXu).ToString()), style, 0, 11);//表格列数 - #region 头部 - //行0 - CellRangeAddress region = new CellRangeAddress(rowIndex, rowIndex + 1, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(0).SetCellValue("浙江石油化工有限公司"); - ws.GetRow(rowIndex).GetCell(0).CellStyle = centerstyle; - ws.GetRow(rowIndex).GetCell(1).CellStyle = centerstyle; - ws.GetRow(rowIndex).GetCell(2).CellStyle = centerstyle; - - region = new CellRangeAddress(rowIndex, rowIndex + 1, 3, 7); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(3).SetCellValue("管道焊缝返修检测委托单"); - ws.GetRow(rowIndex).GetCell(3).CellStyle = titleStyle; - ws.GetRow(rowIndex).GetCell(4).CellStyle = titleStyle; - ws.GetRow(rowIndex).GetCell(5).CellStyle = titleStyle; - ws.GetRow(rowIndex).GetCell(6).CellStyle = titleStyle; - ws.GetRow(rowIndex).GetCell(7).CellStyle = titleStyle; - - region = new CellRangeAddress(rowIndex, rowIndex, 8, 11); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(8).SetCellValue("工程名称:" + tbTitle.Rows[0]["ProjectName"].ToString()); - ws.GetRow(rowIndex).GetCell(8).CellStyle = leftstyle; - ws.GetRow(rowIndex).GetCell(9).CellStyle = leftstyle; - ws.GetRow(rowIndex).GetCell(10).CellStyle = leftstyle; - ws.GetRow(rowIndex).GetCell(11).CellStyle = leftstyle; - - //行1 - region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 8, 11); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 1).GetCell(8).SetCellValue("单位工程名称:管道安装"); - ws.GetRow(rowIndex + 1).GetCell(8).CellStyle = leftstyle; - - //行2 - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("装置名称"); - - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 2, 5); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue(tbTitle.Rows[0]["InstallationName"].ToString()); - - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 6, 7); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("装置主项号"); - - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 11); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue(tbTitle.Rows[0]["InstallationCode"].ToString()); - - //行3 - region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("委托单位"); - - region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 5); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue(tbTitle.Rows[0]["UnitName"].ToString()); - - region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 6, 7); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("委托单编号"); - - region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 8, 11); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue(tbTitle.Rows[0]["CH_TrustCode"].ToString()); - - //行4 - region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("承包商"); - - ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue("鼎盛石化工程有限公司"); - - region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 3, 4); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 4).GetCell(3).SetCellValue("检测单位"); - - region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue(tbTitle.Rows[0]["CheckUnitName"].ToString()); - - ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("检件名称"); - - region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 8, 9); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 4).GetCell(8).SetCellValue("工业管道"); - - ws.GetRow(rowIndex + 4).GetCell(10).SetCellValue("外观检查"); - - ws.GetRow(rowIndex + 4).GetCell(11).SetCellValue("合格"); - - //行5 - region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("焊接方法"); - - ws.GetRow(rowIndex + 5).GetCell(2).SetCellValue(tbTitle.Rows[0]["WME_Code"].ToString()); - - region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 3, 4); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 5).GetCell(3).SetCellValue("热处理状态"); - - region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 5, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue(tbTitle.Rows[0]["IsHot"].ToString()); - - ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("坡口形式"); - - region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 8, 9); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue(tbTitle.Rows[0]["JST_Code"].ToString()); - - ws.GetRow(rowIndex + 5).GetCell(10).SetCellValue("检测比例"); - - ws.GetRow(rowIndex + 5).GetCell(11).SetCellValue(tbTitle.Rows[0]["NDTR_Name"].ToString()); - - //行6 - region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("检测方法"); - - ws.GetRow(rowIndex + 6).GetCell(2).SetCellValue(tbTitle.Rows[0]["NDT_Code"].ToString()); - - region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 3, 4); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 6).GetCell(3).SetCellValue("检测时机"); - - region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue("焊后"); - - ws.GetRow(rowIndex + 6).GetCell(7).SetCellValue("技术等级"); - - region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 8, 9); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 6).GetCell(8).SetCellValue("AB级"); - - ws.GetRow(rowIndex + 6).GetCell(10).SetCellValue("合格级别"); - - ws.GetRow(rowIndex + 6).GetCell(11).SetCellValue(tbTitle.Rows[0]["AcceptGrade"].ToString()); - - //行7 - region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("检测标准"); - - ws.GetRow(rowIndex + 7).GetCell(2).SetCellValue(tbTitle.Rows[0]["CH_NDTCriteria"].ToString()); - - region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 3, 4); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 7).GetCell(3).SetCellValue("检测部位"); - - region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 5, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 7).GetCell(5).SetCellValue("焊缝"); - - ws.GetRow(rowIndex + 7).GetCell(7).SetCellValue("焊口总数"); - - region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 8, 9); - ws.AddMergedRegion(region); - string isoid = tb.Rows[0]["ISO_ID"].ToString(); - string jotyId = tb.Rows[0]["JOTY_ID"].ToString(); - int jointCount = BLL.HJGL_PW_JointInfoService.GetJointCountByIsoId(isoid, jotyId); - ws.GetRow(rowIndex + 7).GetCell(8).SetCellValue(jointCount.ToString()); - - ws.GetRow(rowIndex + 7).GetCell(10).SetCellValue("检测数量"); - ws.GetRow(rowIndex + 7).GetCell(11).SetCellValue((tb.Rows.Count-1).ToString()); - - #endregion - - #region 表格 - var dataTit = rowIndex + 8; - //合并单元格 - for (int hb = dataTit; hb <= rowIndex + titIsXu; hb++) - { - region = new CellRangeAddress(hb, hb, 1, 3); - ws.AddMergedRegion(region); - region = new CellRangeAddress(hb, hb, 5, 6); - ws.AddMergedRegion(region); - region = new CellRangeAddress(hb, hb, 8, 9); - ws.AddMergedRegion(region); - } - - //每页数据开始和结束条数 - var dStart = i == 1 ? 0 : (i - 1) * 16; - var dEnd = i * 16; - - //获取当前页数据 - var pageTb = GetPageToTable(tb, dStart, dEnd); - - - //列头 - ws.GetRow(dataTit).GetCell(0).SetCellValue("序号"); - ws.GetRow(dataTit).GetCell(1).SetCellValue("管线编号"); - ws.GetRow(dataTit).GetCell(4).SetCellValue("单线号"); - ws.GetRow(dataTit).GetCell(5).SetCellValue("焊口编号"); - ws.GetRow(dataTit).GetCell(7).SetCellValue("焊口规格"); - ws.GetRow(dataTit).GetCell(8).SetCellValue("材质"); - ws.GetRow(dataTit).GetCell(10).SetCellValue("焊工号"); - ws.GetRow(dataTit).GetCell(11).SetCellValue("管道等级"); - - //数据 - for (int j = 0; j < pageTb.Rows.Count; j++) - { - int dataIndex = dataTit + j + 1; - ws.GetRow(dataIndex).GetCell(0).SetCellValue(pageTb.Rows[j]["Number"].ToString()); - ws.GetRow(dataIndex).GetCell(1).SetCellValue(pageTb.Rows[j]["ISO_IsoNo"].ToString()); - ws.GetRow(dataIndex).GetCell(4).SetCellValue(pageTb.Rows[j]["ISO_IsoNo"].ToString()); - ws.GetRow(dataIndex).GetCell(5).SetCellValue(pageTb.Rows[j]["JOT_JointNo"].ToString()); - ws.GetRow(dataIndex).GetCell(7).SetCellValue(pageTb.Rows[j]["JOT_JointDesc"].ToString()); - ws.GetRow(dataIndex).GetCell(8).SetCellValue(pageTb.Rows[j]["STE_Code"].ToString()); - ws.GetRow(dataIndex).GetCell(10).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString()); - ws.GetRow(dataIndex).GetCell(11).SetCellValue(pageTb.Rows[j]["ISC_IsoName"].ToString()); - } - - #endregion - - #region 尾部 - //尾部样式无线条 - ICellStyle noneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10); - var tEnd = int.Parse((rowIndex + titIsXu + 1).ToString()); - ////创建尾部 - ws.CreateRow(tEnd); - ws.CreateRow(tEnd).HeightInPoints = 21f; - ws.CreateRow(tEnd + 1); - ws.CreateRow(tEnd + 1).HeightInPoints = 21f; - ws.CreateRow(tEnd + 2); - ws.CreateRow(tEnd + 2).HeightInPoints = 21f; - ws.CreateRow(tEnd + 3); - ws.CreateRow(tEnd + 3).HeightInPoints = 21f; - ws.CreateRow(tEnd + 4); - ws.CreateRow(tEnd + 4).HeightInPoints = 21f; - ws.CreateRow(tEnd + 5); - ws.CreateRow(tEnd + 5).HeightInPoints = 21f; - ws.CreateRow(tEnd + 6); - ws.CreateRow(tEnd + 6).HeightInPoints = 21f; - - for (int eIndex = 0; eIndex <= 12; eIndex++) - { - ws.GetRow(tEnd).CreateCell(eIndex); - ws.GetRow(tEnd).GetCell(eIndex).CellStyle = noneStyle; - //行1 - ws.GetRow(tEnd + 1).CreateCell(eIndex); - ws.GetRow(tEnd + 1).GetCell(eIndex).CellStyle = noneStyle; - //行2 - ws.GetRow(tEnd + 2).CreateCell(eIndex); - ws.GetRow(tEnd + 2).GetCell(eIndex).CellStyle = noneStyle; - //行3 - ws.GetRow(tEnd + 3).CreateCell(eIndex); - ws.GetRow(tEnd + 3).GetCell(eIndex).CellStyle = noneStyle; - //行4 - ws.GetRow(tEnd + 4).CreateCell(eIndex); - ws.GetRow(tEnd + 4).GetCell(eIndex).CellStyle = noneStyle; - //行5 - ws.GetRow(tEnd + 5).CreateCell(eIndex); - ws.GetRow(tEnd + 5).GetCell(eIndex).CellStyle = noneStyle; - //行6 - ws.GetRow(tEnd + 6).CreateCell(eIndex); - ws.GetRow(tEnd + 6).GetCell(eIndex).CellStyle = noneStyle; - } - - //尾部样式左侧线条文字靠左 - ICellStyle leftStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - //尾部样式右侧线条文字靠左 - ICellStyle rightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - //尾部样式上、下、左侧线文字居中 - ICellStyle topBottomLeftStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10); - //上、下线文字靠左 - ICellStyle topBottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - //上、下、右侧线文字靠左 - ICellStyle topBottomRightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - //左、下线文字居左 - ICellStyle leftBottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - //下线文字靠左 - ICellStyle bottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - //下、右侧线文字靠左 - ICellStyle bottomRightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - - //尾部行1 - region = new CellRangeAddress(tEnd, tEnd, 0, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd).GetCell(0).SetCellValue("注:"); - ws.GetRow(tEnd).GetCell(0).CellStyle = leftStyle; - ws.GetRow(tEnd).GetCell(11).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 1, tEnd + 1, 0, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 1).GetCell(0).SetCellValue("1、附图 张;"); - ws.GetRow(tEnd + 1).GetCell(0).CellStyle = leftStyle; - ws.GetRow(tEnd + 1).GetCell(11).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 2, tEnd + 2, 0, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 2).GetCell(0).SetCellValue("2、需要说明的其他问题:"); - ws.GetRow(tEnd + 2).GetCell(0).CellStyle = leftStyle; - ws.GetRow(tEnd + 2).GetCell(11).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 3, tEnd + 3, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 3).GetCell(0).SetCellValue("承包商"); - ws.GetRow(tEnd + 3).GetCell(0).CellStyle = topBottomLeftStyle; - ws.GetRow(tEnd + 3).GetCell(1).CellStyle = topBottomStyle; - ws.GetRow(tEnd + 3).GetCell(2).CellStyle = topBottomRightStyle; - - region = new CellRangeAddress(tEnd + 3, tEnd + 3, 3, 5); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 3).GetCell(3).SetCellValue("监理单位"); - ws.GetRow(tEnd + 3).GetCell(3).CellStyle = topBottomLeftStyle; - ws.GetRow(tEnd + 3).GetCell(4).CellStyle = topBottomStyle; - ws.GetRow(tEnd + 3).GetCell(5).CellStyle = topBottomRightStyle; - - region = new CellRangeAddress(tEnd + 3, tEnd + 3, 6, 8); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 3).GetCell(6).SetCellValue("项目部"); - ws.GetRow(tEnd + 3).GetCell(6).CellStyle = topBottomLeftStyle; - ws.GetRow(tEnd + 3).GetCell(7).CellStyle = topBottomStyle; - ws.GetRow(tEnd + 3).GetCell(8).CellStyle = topBottomRightStyle; - - region = new CellRangeAddress(tEnd + 3, tEnd + 3, 9, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 3).GetCell(9).SetCellValue("检测单位"); - ws.GetRow(tEnd + 3).GetCell(9).CellStyle = topBottomLeftStyle; - ws.GetRow(tEnd + 3).GetCell(10).CellStyle = topBottomStyle; - ws.GetRow(tEnd + 3).GetCell(11).CellStyle = topBottomRightStyle; - - region = new CellRangeAddress(tEnd + 4, tEnd + 4, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 4).GetCell(0).SetCellValue(""); - ws.GetRow(tEnd + 4).GetCell(0).CellStyle = leftStyle; - ws.GetRow(tEnd + 4).GetCell(2).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 4, tEnd + 4, 3, 5); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 4).GetCell(3).SetCellValue(""); - ws.GetRow(tEnd + 4).GetCell(3).CellStyle = leftStyle; - ws.GetRow(tEnd + 4).GetCell(5).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 4, tEnd + 4, 6, 8); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 4).GetCell(6).SetCellValue(""); - ws.GetRow(tEnd + 4).GetCell(6).CellStyle = leftStyle; - ws.GetRow(tEnd + 4).GetCell(8).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 4, tEnd + 4, 9, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 4).GetCell(9).SetCellValue(""); - ws.GetRow(tEnd + 4).GetCell(9).CellStyle = leftStyle; - ws.GetRow(tEnd + 4).GetCell(11).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 5, tEnd + 5, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 5).GetCell(0).SetCellValue("签字:"); - ws.GetRow(tEnd + 5).GetCell(0).CellStyle = leftStyle; - ws.GetRow(tEnd + 5).GetCell(2).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 5, tEnd + 5, 3, 5); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 5).GetCell(3).SetCellValue("签字:"); - ws.GetRow(tEnd + 5).GetCell(3).CellStyle = leftStyle; - ws.GetRow(tEnd + 5).GetCell(5).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 5, tEnd + 5, 6, 8); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 5).GetCell(6).SetCellValue("签字:"); - ws.GetRow(tEnd + 5).GetCell(6).CellStyle = leftStyle; - ws.GetRow(tEnd + 5).GetCell(8).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 5, tEnd + 5, 9, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 5).GetCell(9).SetCellValue("签字:"); - ws.GetRow(tEnd + 5).GetCell(9).CellStyle = leftStyle; - ws.GetRow(tEnd + 5).GetCell(11).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 6, tEnd + 6, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 6).GetCell(0).SetCellValue("日期:"); - ws.GetRow(tEnd + 6).GetCell(0).CellStyle = leftBottomStyle; - ws.GetRow(tEnd + 6).GetCell(1).CellStyle = bottomStyle; - ws.GetRow(tEnd + 6).GetCell(2).CellStyle = bottomRightStyle; - - region = new CellRangeAddress(tEnd + 6, tEnd + 6, 3, 5); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 6).GetCell(3).SetCellValue("日期:"); - ws.GetRow(tEnd + 6).GetCell(3).CellStyle = leftBottomStyle; - ws.GetRow(tEnd + 6).GetCell(4).CellStyle = bottomStyle; - ws.GetRow(tEnd + 6).GetCell(5).CellStyle = bottomRightStyle; - - region = new CellRangeAddress(tEnd + 6, tEnd + 6, 6, 8); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 6).GetCell(6).SetCellValue("日期:"); - ws.GetRow(tEnd + 6).GetCell(6).CellStyle = leftBottomStyle; - ws.GetRow(tEnd + 6).GetCell(7).CellStyle = bottomStyle; - ws.GetRow(tEnd + 6).GetCell(8).CellStyle = bottomRightStyle; - - region = new CellRangeAddress(tEnd + 6, tEnd + 6, 9, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 6).GetCell(9).SetCellValue("日期:"); - ws.GetRow(tEnd + 6).GetCell(9).CellStyle = leftBottomStyle; - ws.GetRow(tEnd + 6).GetCell(10).CellStyle = bottomStyle; - ws.GetRow(tEnd + 6).GetCell(11).CellStyle = bottomRightStyle; - - #endregion - - rowIndex += int.Parse((titIsXu + 8).ToString()); - } - } - } - } - - ws.SetMargin(MarginType.LeftMargin, 0.7); - ws.SetMargin(MarginType.RightMargin, 0.5); - - ws.PrintSetup.Landscape = false; - ws.PrintSetup.PaperSize = 9; - - ws.ForceFormulaRecalculation = true; - using (FileStream filess = File.OpenWrite(ReportFileName)) - { - hssfworkbook.Write(filess); - } - FileInfo filet = new FileInfo(ReportFileName); - Response.Clear(); - Response.Charset = "GB2312"; - Response.ContentEncoding = System.Text.Encoding.UTF8; - // 添加头信息,为"文件下载/另存为"对话框指定默认文件名 - Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode("返修焊缝委托单.xlsx")); - // 添加头信息,指定文件大小,让浏览器能够显示下载进度 - Response.AddHeader("Content-Length", filet.Length.ToString()); - // 指定返回的是一个不能被客户端读取的流,必须被下载 - Response.ContentType = "application/ms-excel"; - // 把文件流发送到客户端 - Response.WriteFile(filet.FullName); - // 停止页面的执行 - Response.End(); - } + #endregion } #endregion diff --git a/HJGL_DS/FineUIPro.Web/ContinuousPrint/TestOrderPrint.aspx b/HJGL_DS/FineUIPro.Web/ContinuousPrint/TestOrderPrint.aspx index 1bacafd..cafe50d 100644 --- a/HJGL_DS/FineUIPro.Web/ContinuousPrint/TestOrderPrint.aspx +++ b/HJGL_DS/FineUIPro.Web/ContinuousPrint/TestOrderPrint.aspx @@ -113,7 +113,7 @@ - diff --git a/HJGL_DS/FineUIPro.Web/ContinuousPrint/TestOrderPrint.aspx.cs b/HJGL_DS/FineUIPro.Web/ContinuousPrint/TestOrderPrint.aspx.cs index e5201cf..5eadc0d 100644 --- a/HJGL_DS/FineUIPro.Web/ContinuousPrint/TestOrderPrint.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/ContinuousPrint/TestOrderPrint.aspx.cs @@ -185,35 +185,13 @@ namespace FineUIPro.Web.ContinuousPrint Alert.ShowInTop("最少选中一行!", MessageBoxIcon.Warning); return; } - string rootPath = Server.MapPath("~/") + Const.ExcelUrl; - //导出文件 - string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\"; - if (!Directory.Exists(filePath)) - { - Directory.CreateDirectory(filePath); - } - string ReportFileName = filePath + "out1.xlsx"; + + string initTemplatePath = ""; + string rootPath = Server.MapPath("~/"); + BLL.Common.FastReportService.ResetData(); + if (Grid2.Rows.Count > 0) { - int rowIndex = 0; - XSSFWorkbook hssfworkbook = new XSSFWorkbook(); - XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("检测委托单"); - - #region 列宽 - ws.SetColumnWidth(0, 5 * 256 + 164);//5 - ws.SetColumnWidth(1, 5 * 256);//4.36 - ws.SetColumnWidth(2, 12 * 256); //11.36 - ws.SetColumnWidth(3, 2 * 256); //1.36 - ws.SetColumnWidth(4, 12 * 256);//11.36 - ws.SetColumnWidth(5, 6 * 256);//5.36 - ws.SetColumnWidth(6, 5 * 256);//4.36 - ws.SetColumnWidth(7, 10 * 256);//9.36 - ws.SetColumnWidth(8, 5 * 256);//4.36 - ws.SetColumnWidth(9, 8 * 256);//7.36 - ws.SetColumnWidth(10, 10 * 256);//9.36 - ws.SetColumnWidth(11, 10 * 256);//9.36 - #endregion - for (int gi = 0; gi < Grid2.Rows.Count; gi++) { if (Grid2.SelectedRowIndexArray.Contains(gi)) @@ -228,517 +206,713 @@ namespace FineUIPro.Web.ContinuousPrint trust.CH_Printer = this.CurrUser.UserName; HJGL_TrustManageEditService.PrintCH_Trust(trust); } - //列表 - var listStr = new List(); - listStr.Add(new SqlParameter("@CH_TrustID", CH_TrustID.Value)); - SqlParameter[] parameter = listStr.ToArray(); - var tb = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_TrustItem", parameter); + //头部 var listTitleStr = new List(); listTitleStr.Add(new SqlParameter("@CH_TrustID", CH_TrustID.Value)); SqlParameter[] titleparameter = listTitleStr.ToArray(); var tbTitle = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_Trust", titleparameter); - if (tb.Rows.Count > 0 && tbTitle.Rows.Count > 0) + + DataTable dt = new DataTable(); + dt.TableName = "MainData"; + dt.Columns.Add("ProjectName"); + dt.Columns.Add("InstallastionName"); + dt.Columns.Add("InstallatinCode"); + dt.Columns.Add("TrustUnit"); + dt.Columns.Add("TrustCode"); + dt.Columns.Add("CheckUnit"); + dt.Columns.Add("ItemName"); + dt.Columns.Add("WME_Code"); + dt.Columns.Add("IsHot"); + dt.Columns.Add("JST_Name"); + dt.Columns.Add("NDTR_Name"); + dt.Columns.Add("NDT_Code"); + dt.Columns.Add("AcceptGrade"); + dt.Columns.Add("CH_NDTCriteria"); + + DataRow[] rows = tbTitle.DefaultView.ToTable().Select(); + foreach (var row in rows) { - var allPageNum = Math.Ceiling((float)tb.Rows.Count / 15); - var titIsXu = 26; - for (int i = 1; i <= allPageNum; i++) + var newRow = dt.NewRow(); + newRow["ProjectName"] = row["ProjectName"].ToString(); + newRow["InstallastionName"] = row["InstallationName"].ToString(); + newRow["InstallatinCode"] = row["InstallationCode"].ToString(); + newRow["TrustUnit"] = row["UnitName"].ToString(); + newRow["TrustCode"] = row["CH_TrustCode"].ToString(); + newRow["CheckUnit"] = row["CheckUnitName"].ToString(); + newRow["ItemName"] = row["CH_ItemName"].ToString(); + newRow["WME_Code"] = row["WME_Code"].ToString(); + newRow["IsHot"] = "合格"; + newRow["JST_Name"] = row["JST_Name"]; + newRow["NDTR_Name"] = row["NDTR_Name"]; + newRow["NDT_Code"] = row["NDT_Code"]; + if (row["NDT_Code"].ToString() == "PT") { - //公共样式 - ICellStyle style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true); - //有边框文字居左 - ICellStyle leftstyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true); - //有边框文字居中 - ICellStyle centerstyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 12, true); - //底部双底虚线 - ICellStyle doubleLinestyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Double, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true); - //无边框文字靠左 - ICellStyle leftNoneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true); - //无边框文字靠右 - ICellStyle rightNoneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10, true); - //头部样式 - ICellStyle titleStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 11, true, true, "黑体"); - ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, int.Parse((rowIndex + titIsXu).ToString()), style, 0, 11);//表格列数 - #region 头部 - //行0 - CellRangeAddress region = new CellRangeAddress(rowIndex, rowIndex + 1, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(0).SetCellValue("浙江石油化工有限公司"); - ws.GetRow(rowIndex).GetCell(0).CellStyle = centerstyle; - ws.GetRow(rowIndex).GetCell(1).CellStyle = centerstyle; - ws.GetRow(rowIndex).GetCell(2).CellStyle = centerstyle; - - region = new CellRangeAddress(rowIndex, rowIndex + 1, 3, 7); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(3).SetCellValue("管道焊缝检测委托单"); - ws.GetRow(rowIndex).GetCell(3).CellStyle = titleStyle; - ws.GetRow(rowIndex).GetCell(4).CellStyle = titleStyle; - ws.GetRow(rowIndex).GetCell(5).CellStyle = titleStyle; - ws.GetRow(rowIndex).GetCell(6).CellStyle = titleStyle; - ws.GetRow(rowIndex).GetCell(7).CellStyle = titleStyle; - - region = new CellRangeAddress(rowIndex, rowIndex, 8, 11); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(8).SetCellValue("工程名称:" + tbTitle.Rows[0]["ProjectName"].ToString()); - ws.GetRow(rowIndex).GetCell(8).CellStyle = leftstyle; - ws.GetRow(rowIndex).GetCell(9).CellStyle = leftstyle; - ws.GetRow(rowIndex).GetCell(10).CellStyle = leftstyle; - ws.GetRow(rowIndex).GetCell(11).CellStyle = leftstyle; - - //行1 - region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 8, 11); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex+1).GetCell(8).SetCellValue("单位工程名称:管道安装"); - ws.GetRow(rowIndex + 1).GetCell(8).CellStyle = leftstyle; - - //行2 - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("装置名称"); - - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 2, 5); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue(tbTitle.Rows[0]["InstallationName"].ToString()); - - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 6, 7); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("装置主项号"); - - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 11); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue(tbTitle.Rows[0]["InstallationCode"].ToString()); - - //行3 - region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("委托单位"); - - region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 5); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue(tbTitle.Rows[0]["UnitName"].ToString()); - - region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 6, 7); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("委托单编号"); - - region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 8, 11); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue(tbTitle.Rows[0]["CH_TrustCode"].ToString()); - - //行4 - region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("承包商"); - - ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue("鼎盛石化工程有限公司"); - - region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 3, 4); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 4).GetCell(3).SetCellValue("检测单位"); - - region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue(tbTitle.Rows[0]["CheckUnitName"].ToString()); - - ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("检件名称"); - - region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 8, 9); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 4).GetCell(8).SetCellValue("工业管道"); - - ws.GetRow(rowIndex + 4).GetCell(10).SetCellValue("外观检查"); - - ws.GetRow(rowIndex + 4).GetCell(11).SetCellValue("合格"); - - //行5 - region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("焊接方法"); - - ws.GetRow(rowIndex + 5).GetCell(2).SetCellValue(tbTitle.Rows[0]["WME_Code"].ToString()); - - region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 3, 4); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 5).GetCell(3).SetCellValue("热处理状态"); - - region = new CellRangeAddress(rowIndex +5, rowIndex + 5, 5, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue(tbTitle.Rows[0]["IsHot"].ToString()); - - ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("坡口形式"); - - region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 8, 9); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue(tbTitle.Rows[0]["JST_Name"].ToString()); - - ws.GetRow(rowIndex + 5).GetCell(10).SetCellValue("检测比例"); - - ws.GetRow(rowIndex + 5).GetCell(11).SetCellValue(tbTitle.Rows[0]["NDTR_Name"].ToString()); - - //行6 - region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("检测方法"); - - ws.GetRow(rowIndex + 6).GetCell(2).SetCellValue(tbTitle.Rows[0]["NDT_Code"].ToString()); - - region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 3, 4); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 6).GetCell(3).SetCellValue("检测时机"); - - region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue("焊后"); - - ws.GetRow(rowIndex + 6).GetCell(7).SetCellValue("技术等级"); - - region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 8, 9); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 6).GetCell(8).SetCellValue("AB级"); - - ws.GetRow(rowIndex + 6).GetCell(10).SetCellValue("合格级别"); - - string acceptGrade = string.Empty; - if (tbTitle.Rows[0]["NDT_Code"].ToString() == "PT") - { - acceptGrade = "Ⅰ"; - } - else - { - int rate = Funs.GetNewIntOrZero(tbTitle.Rows[0]["NDTR_Name"].ToString()); - if (tbTitle.Rows[0]["NDT_Code"].ToString() == "RT" && rate < 20) - { - acceptGrade = "Ⅲ"; - } - else if (tbTitle.Rows[0]["NDT_Code"].ToString() == "RT" && rate >= 20) - { - acceptGrade = "Ⅱ"; - } - else - { - acceptGrade = tbTitle.Rows[0]["AcceptGrade"].ToString(); - } - } - ws.GetRow(rowIndex + 6).GetCell(11).SetCellValue(acceptGrade); - - //行7 - region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("检测标准"); - string ndtcriterial = string.Empty; - if (tbTitle.Rows[0]["NDT_Code"].ToString() == "RT") - { - ndtcriterial = "NB/T 47013.2-2015"; - } - else if (tbTitle.Rows[0]["NDT_Code"].ToString() == "PT") - { - ndtcriterial = "NB/T 47013.5-2015"; - } - else if (tbTitle.Rows[0]["NDT_Code"].ToString() == "UT") - { - ndtcriterial = "NB/T 47013.3-2015"; - } - else if (tbTitle.Rows[0]["NDT_Code"].ToString() == "MT") - { - ndtcriterial = "NB/T 47013.4-2015"; - } - else if (tbTitle.Rows[0]["NDT_Code"].ToString() == "PAUT") - { - ndtcriterial = "NB/T 47013.15-2021"; - } - else - { - ndtcriterial = tbTitle.Rows[0]["CH_NDTCriteria"].ToString(); - } - ws.GetRow(rowIndex + 7).GetCell(2).SetCellValue(ndtcriterial); - - region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 3, 4); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 7).GetCell(3).SetCellValue("检测部位"); - - region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 5, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 7).GetCell(5).SetCellValue("焊缝"); - - ws.GetRow(rowIndex + 7).GetCell(7).SetCellValue("焊口总数"); - - region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 8, 9); - ws.AddMergedRegion(region); - - int jointCount = BLL.HJGL_PW_JointInfoService.GetJointCountByIsoId(tb.Rows[0]["ISO_ID"].ToString(), tb.Rows[0]["JOTY_ID"].ToString()); - - ws.GetRow(rowIndex + 7).GetCell(8).SetCellValue(jointCount.ToString()); - - ws.GetRow(rowIndex + 7).GetCell(10).SetCellValue("检测数量"); - ws.GetRow(rowIndex + 7).GetCell(11).SetCellValue((tb.Rows.Count - 1).ToString()); - - #endregion - - #region 表格 - var dataTit = rowIndex + 8; - //合并单元格 - for (int hb = dataTit; hb <= rowIndex + titIsXu; hb++) - { - region = new CellRangeAddress(hb, hb, 1, 3); - ws.AddMergedRegion(region); - region = new CellRangeAddress(hb, hb, 5, 6); - ws.AddMergedRegion(region); - region = new CellRangeAddress(hb, hb, 8, 9); - ws.AddMergedRegion(region); - } - - //每页数据开始和结束条数 - var dStart = i == 1 ? 0 : (i - 1) * 16; - var dEnd = i * 16; - - //获取当前页数据 - var pageTb = GetPageToTable(tb, dStart, dEnd); - - - //列头 - ws.GetRow(dataTit).GetCell(0).SetCellValue("序号"); - ws.GetRow(dataTit).GetCell(1).SetCellValue("管线编号"); - ws.GetRow(dataTit).GetCell(4).SetCellValue("单线号"); - ws.GetRow(dataTit).GetCell(5).SetCellValue("焊口编号"); - ws.GetRow(dataTit).GetCell(7).SetCellValue("焊口规格"); - ws.GetRow(dataTit).GetCell(8).SetCellValue("材质"); - ws.GetRow(dataTit).GetCell(10).SetCellValue("焊工号"); - ws.GetRow(dataTit).GetCell(11).SetCellValue("管道等级"); - - //数据 - for (int j = 0; j < pageTb.Rows.Count; j++) - { - int dataIndex = dataTit + j + 1; - ws.GetRow(dataIndex).GetCell(0).SetCellValue(pageTb.Rows[j]["Number"].ToString()); - ws.GetRow(dataIndex).GetCell(1).SetCellValue(pageTb.Rows[j]["ISO_IsoNo"].ToString()); - ws.GetRow(dataIndex).GetCell(4).SetCellValue(pageTb.Rows[j]["ISO_Number"].ToString()); - ws.GetRow(dataIndex).GetCell(5).SetCellValue(pageTb.Rows[j]["JOT_JointNo"].ToString()); - ws.GetRow(dataIndex).GetCell(7).SetCellValue(pageTb.Rows[j]["JOT_JointDesc"].ToString()); - ws.GetRow(dataIndex).GetCell(8).SetCellValue(pageTb.Rows[j]["STE_Code"].ToString()); - ws.GetRow(dataIndex).GetCell(10).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString()); - ws.GetRow(dataIndex).GetCell(11).SetCellValue(pageTb.Rows[j]["ISC_IsoName"].ToString()); - } - - #endregion - - #region 尾部 - //尾部样式无线条 - ICellStyle noneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10); - var tEnd = int.Parse((rowIndex + titIsXu + 1).ToString()); - ////创建尾部 - ws.CreateRow(tEnd); - ws.CreateRow(tEnd).HeightInPoints = 21f; - ws.CreateRow(tEnd+1); - ws.CreateRow(tEnd+1).HeightInPoints = 21f; - ws.CreateRow(tEnd + 2); - ws.CreateRow(tEnd + 2).HeightInPoints = 21f; - ws.CreateRow(tEnd + 3); - ws.CreateRow(tEnd + 3).HeightInPoints = 21f; - ws.CreateRow(tEnd + 4); - ws.CreateRow(tEnd + 4).HeightInPoints = 21f; - ws.CreateRow(tEnd + 5); - ws.CreateRow(tEnd + 5).HeightInPoints = 21f; - ws.CreateRow(tEnd + 6); - ws.CreateRow(tEnd + 6).HeightInPoints = 21f; - - for (int eIndex = 0; eIndex <= 12; eIndex++) - { - ws.GetRow(tEnd).CreateCell(eIndex); - ws.GetRow(tEnd).GetCell(eIndex).CellStyle = noneStyle; - //行1 - ws.GetRow(tEnd + 1).CreateCell(eIndex); - ws.GetRow(tEnd + 1).GetCell(eIndex).CellStyle = noneStyle; - //行2 - ws.GetRow(tEnd + 2).CreateCell(eIndex); - ws.GetRow(tEnd + 2).GetCell(eIndex).CellStyle = noneStyle; - //行3 - ws.GetRow(tEnd + 3).CreateCell(eIndex); - ws.GetRow(tEnd + 3).GetCell(eIndex).CellStyle = noneStyle; - //行4 - ws.GetRow(tEnd + 4).CreateCell(eIndex); - ws.GetRow(tEnd + 4).GetCell(eIndex).CellStyle = noneStyle; - //行5 - ws.GetRow(tEnd + 5).CreateCell(eIndex); - ws.GetRow(tEnd + 5).GetCell(eIndex).CellStyle = noneStyle; - //行6 - ws.GetRow(tEnd + 6).CreateCell(eIndex); - ws.GetRow(tEnd + 6).GetCell(eIndex).CellStyle = noneStyle; - } - - //尾部样式左侧线条文字靠左 - ICellStyle leftStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - //尾部样式右侧线条文字靠左 - ICellStyle rightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - //尾部样式上、下、左侧线文字居中 - ICellStyle topBottomLeftStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10); - //上、下线文字靠左 - ICellStyle topBottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - //上、下、右侧线文字靠左 - ICellStyle topBottomRightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - //左、下线文字居左 - ICellStyle leftBottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - //下线文字靠左 - ICellStyle bottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - //下、右侧线文字靠左 - ICellStyle bottomRightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); - - //尾部行1 - region = new CellRangeAddress(tEnd, tEnd, 0, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd).GetCell(0).SetCellValue("注:"); - ws.GetRow(tEnd).GetCell(0).CellStyle = leftStyle; - ws.GetRow(tEnd).GetCell(11).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 1, tEnd + 1, 0, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 1).GetCell(0).SetCellValue("1、附图 张;"); - ws.GetRow(tEnd + 1).GetCell(0).CellStyle = leftStyle; - ws.GetRow(tEnd + 1).GetCell(11).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 2, tEnd + 2, 0, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 2).GetCell(0).SetCellValue("2、需要说明的其他问题:"); - ws.GetRow(tEnd + 2).GetCell(0).CellStyle = leftStyle; - ws.GetRow(tEnd + 2).GetCell(11).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 3, tEnd + 3, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 3).GetCell(0).SetCellValue("承包商"); - ws.GetRow(tEnd + 3).GetCell(0).CellStyle = topBottomLeftStyle; - ws.GetRow(tEnd + 3).GetCell(1).CellStyle = topBottomStyle; - ws.GetRow(tEnd + 3).GetCell(2).CellStyle = topBottomRightStyle; - - region = new CellRangeAddress(tEnd + 3, tEnd + 3, 3, 5); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 3).GetCell(3).SetCellValue("监理单位"); - ws.GetRow(tEnd + 3).GetCell(3).CellStyle = topBottomLeftStyle; - ws.GetRow(tEnd + 3).GetCell(4).CellStyle = topBottomStyle; - ws.GetRow(tEnd + 3).GetCell(5).CellStyle = topBottomRightStyle; - - region = new CellRangeAddress(tEnd + 3, tEnd + 3, 6, 8); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 3).GetCell(6).SetCellValue("项目部"); - ws.GetRow(tEnd + 3).GetCell(6).CellStyle = topBottomLeftStyle; - ws.GetRow(tEnd + 3).GetCell(7).CellStyle = topBottomStyle; - ws.GetRow(tEnd + 3).GetCell(8).CellStyle = topBottomRightStyle; - - region = new CellRangeAddress(tEnd + 3, tEnd + 3, 9, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 3).GetCell(9).SetCellValue("检测单位"); - ws.GetRow(tEnd + 3).GetCell(9).CellStyle = topBottomLeftStyle; - ws.GetRow(tEnd + 3).GetCell(10).CellStyle = topBottomStyle; - ws.GetRow(tEnd + 3).GetCell(11).CellStyle = topBottomRightStyle; - - region = new CellRangeAddress(tEnd + 4, tEnd + 4, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 4).GetCell(0).SetCellValue(""); - ws.GetRow(tEnd + 4).GetCell(0).CellStyle = leftStyle; - ws.GetRow(tEnd + 4).GetCell(2).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 4, tEnd + 4, 3, 5); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 4).GetCell(3).SetCellValue(""); - ws.GetRow(tEnd + 4).GetCell(3).CellStyle = leftStyle; - ws.GetRow(tEnd + 4).GetCell(5).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 4, tEnd + 4, 6, 8); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 4).GetCell(6).SetCellValue(""); - ws.GetRow(tEnd + 4).GetCell(6).CellStyle = leftStyle; - ws.GetRow(tEnd + 4).GetCell(8).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 4, tEnd + 4, 9, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 4).GetCell(9).SetCellValue(""); - ws.GetRow(tEnd + 4).GetCell(9).CellStyle = leftStyle; - ws.GetRow(tEnd + 4).GetCell(11).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 5, tEnd + 5, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 5).GetCell(0).SetCellValue("签字:"); - ws.GetRow(tEnd + 5).GetCell(0).CellStyle = leftStyle; - ws.GetRow(tEnd + 5).GetCell(2).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 5, tEnd + 5, 3, 5); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 5).GetCell(3).SetCellValue("签字:"); - ws.GetRow(tEnd + 5).GetCell(3).CellStyle = leftStyle; - ws.GetRow(tEnd + 5).GetCell(5).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 5, tEnd + 5, 6, 8); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 5).GetCell(6).SetCellValue("签字:"); - ws.GetRow(tEnd + 5).GetCell(6).CellStyle = leftStyle; - ws.GetRow(tEnd + 5).GetCell(8).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 5, tEnd + 5, 9, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 5).GetCell(9).SetCellValue("签字:"); - ws.GetRow(tEnd + 5).GetCell(9).CellStyle = leftStyle; - ws.GetRow(tEnd + 5).GetCell(11).CellStyle = rightStyle; - - region = new CellRangeAddress(tEnd + 6, tEnd + 6, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 6).GetCell(0).SetCellValue("日期:"); - ws.GetRow(tEnd + 6).GetCell(0).CellStyle = leftBottomStyle; - ws.GetRow(tEnd + 6).GetCell(1).CellStyle = bottomStyle; - ws.GetRow(tEnd + 6).GetCell(2).CellStyle = bottomRightStyle; - - region = new CellRangeAddress(tEnd + 6, tEnd + 6, 3, 5); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 6).GetCell(3).SetCellValue("日期:"); - ws.GetRow(tEnd + 6).GetCell(3).CellStyle = leftBottomStyle; - ws.GetRow(tEnd + 6).GetCell(4).CellStyle = bottomStyle; - ws.GetRow(tEnd + 6).GetCell(5).CellStyle = bottomRightStyle; - - region = new CellRangeAddress(tEnd + 6, tEnd + 6, 6, 8); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 6).GetCell(6).SetCellValue("日期:"); - ws.GetRow(tEnd + 6).GetCell(6).CellStyle = leftBottomStyle; - ws.GetRow(tEnd + 6).GetCell(7).CellStyle = bottomStyle; - ws.GetRow(tEnd + 6).GetCell(8).CellStyle = bottomRightStyle; - - region = new CellRangeAddress(tEnd + 6, tEnd + 6, 9, 11); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 6).GetCell(9).SetCellValue("日期:"); - ws.GetRow(tEnd + 6).GetCell(9).CellStyle = leftBottomStyle; - ws.GetRow(tEnd + 6).GetCell(10).CellStyle = bottomStyle; - ws.GetRow(tEnd + 6).GetCell(11).CellStyle = bottomRightStyle; - - #endregion - - rowIndex += int.Parse((titIsXu + 8).ToString()); + newRow["AcceptGrade"] = "Ⅰ"; } + else + { + int rate = Funs.GetNewIntOrZero(row["NDTR_Rate"].ToString()); + if (row["NDT_Code"].ToString() == "RT" && rate < 20) + { + newRow["AcceptGrade"] = "Ⅲ"; + } + else if (row["NDT_Code"].ToString() == "RT" && rate >= 20) + { + newRow["AcceptGrade"] = "Ⅱ"; + } + else + { + newRow["AcceptGrade"] = row["AcceptGrade"].ToString(); + } + } + if (row["NDT_Code"].ToString() == "RT") + { + newRow["CH_NDTCriteria"] = "NB/T 47013.2-2015"; + } + else if (row["NDT_Code"].ToString() == "PT") + { + newRow["CH_NDTCriteria"] = "NB/T 47013.5-2015"; + } + else if (row["NDT_Code"].ToString() == "UT") + { + newRow["CH_NDTCriteria"] = "NB/T 47013.3-2015"; + } + else if (row["NDT_Code"].ToString() == "MT") + { + newRow["CH_NDTCriteria"] = "NB/T 47013.4-2015"; + } + else if (row["NDT_Code"].ToString() == "PAUT") + { + newRow["CH_NDTCriteria"] = "NB/T 47013.15-2021"; + } + else + { + newRow["CH_NDTCriteria"] = row["CH_NDTCriteria"].ToString(); + } + dt.Rows.Add(newRow); + } + BLL.Common.FastReportService.AddFastreportTable(dt); + + //列表 + var listStr = new List(); + listStr.Add(new SqlParameter("@CH_TrustID", CH_TrustID.Value)); + SqlParameter[] parameter = listStr.ToArray(); + var tb2 = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_TrustItem", parameter); + + DataTable dt2 = new DataTable(); + dt2.TableName = "Data"; + dt2.Columns.Add("SortNum"); + dt2.Columns.Add("IsoNo"); + dt2.Columns.Add("ISO_Number"); + dt2.Columns.Add("JointNo"); + dt2.Columns.Add("JointDesc"); + dt2.Columns.Add("Ste_Code"); + dt2.Columns.Add("WelderCode"); + dt2.Columns.Add("ISO_Name"); + + DataView dv = tb2.DefaultView;//获取表视图 + dv.Sort = "ISO_IsoNo,JOT_JointNo ASC";//按照ID倒序排序 + tb2 = dv.ToTable();//转为表 + DataRow[] rows2 = tb2.DefaultView.ToTable().Select(); + int i = 0; + foreach (var row in rows2) + { + var newRows = dt2.NewRow(); + if (i + 1 != rows2.Count()) + { + newRows["SortNum"] = i + 1; + } + newRows["IsoNo"] = row["ISO_IsoNo"].ToString(); + newRows["ISO_Number"] = row["ISO_Number"].ToString(); + newRows["JointNo"] = row["JOT_JointNo"].ToString(); + newRows["JointDesc"] = row["JOT_JointDesc"].ToString(); + newRows["Ste_Code"] = row["STE_Code"].ToString(); + newRows["WelderCode"] = row["WED_Code"].ToString(); + newRows["ISO_Name"] = row["ISC_IsoName"].ToString(); + + dt2.Rows.Add(newRows); + i++; + } + BLL.Common.FastReportService.AddFastreportTable(dt2); + + string isoid = rows2[0]["ISO_ID"].ToString(); + string jotyId = rows2[0]["JOTY_ID"].ToString(); + int jointCount = BLL.HJGL_PW_JointInfoService.GetJointCountByIsoId(isoid, jotyId); + //传参 + Dictionary keyValuePairs = new Dictionary(); + keyValuePairs.Add("JointCount", jointCount.ToString()); + keyValuePairs.Add("CheckCount", (rows.Count() - 1).ToString()); + BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs); + + initTemplatePath = "File\\Fastreport\\管道焊缝检测委托单.frx"; + + if (File.Exists(rootPath + initTemplatePath)) + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../common/ReportPrint/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); + } } } - - ws.SetMargin(MarginType.LeftMargin, 0.7); - ws.SetMargin(MarginType.RightMargin, 0.5); - - ws.PrintSetup.Landscape = false; - ws.PrintSetup.PaperSize = 9; - - ws.ForceFormulaRecalculation = true; - using (FileStream filess = File.OpenWrite(ReportFileName)) - { - hssfworkbook.Write(filess); - } - FileInfo filet = new FileInfo(ReportFileName); - Response.Clear(); - Response.Charset = "GB2312"; - Response.ContentEncoding = System.Text.Encoding.UTF8; - // 添加头信息,为"文件下载/另存为"对话框指定默认文件名 - Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode("检测委托单.xlsx")); - // 添加头信息,指定文件大小,让浏览器能够显示下载进度 - Response.AddHeader("Content-Length", filet.Length.ToString()); - // 指定返回的是一个不能被客户端读取的流,必须被下载 - Response.ContentType = "application/ms-excel"; - // 把文件流发送到客户端 - Response.WriteFile(filet.FullName); - // 停止页面的执行 - Response.End(); } + + + #region 导出excel,不用了 + //string rootPath = Server.MapPath("~/") + Const.ExcelUrl; + ////导出文件 + //string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\"; + //if (!Directory.Exists(filePath)) + //{ + // Directory.CreateDirectory(filePath); + //} + //string ReportFileName = filePath + "out1.xlsx"; + //if (Grid2.Rows.Count > 0) + //{ + // int rowIndex = 0; + // XSSFWorkbook hssfworkbook = new XSSFWorkbook(); + // XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("检测委托单"); + + // #region 列宽 + // ws.SetColumnWidth(0, 5 * 256 + 164);//5 + // ws.SetColumnWidth(1, 5 * 256);//4.36 + // ws.SetColumnWidth(2, 12 * 256); //11.36 + // ws.SetColumnWidth(3, 2 * 256); //1.36 + // ws.SetColumnWidth(4, 12 * 256);//11.36 + // ws.SetColumnWidth(5, 6 * 256);//5.36 + // ws.SetColumnWidth(6, 5 * 256);//4.36 + // ws.SetColumnWidth(7, 10 * 256);//9.36 + // ws.SetColumnWidth(8, 5 * 256);//4.36 + // ws.SetColumnWidth(9, 8 * 256);//7.36 + // ws.SetColumnWidth(10, 10 * 256);//9.36 + // ws.SetColumnWidth(11, 10 * 256);//9.36 + // #endregion + + // for (int gi = 0; gi < Grid2.Rows.Count; gi++) + // { + // if (Grid2.SelectedRowIndexArray.Contains(gi)) + // { + // System.Web.UI.WebControls.HiddenField CH_TrustID = Grid2.Rows[gi].FindControl("hidCH_TrustID") as System.Web.UI.WebControls.HiddenField; + // System.Web.UI.WebControls.HiddenField hidProjectName = Grid2.Rows[gi].FindControl("hidProjectName") as System.Web.UI.WebControls.HiddenField; + // //修改数据 + // Model.HJGL_CH_Trust trust = HJGL_TrustManageEditService.GetCH_TrustByID(CH_TrustID.Value); + // if (trust != null) + // { + // trust.CH_PrintDate = DateTime.Now.Date; + // trust.CH_Printer = this.CurrUser.UserName; + // HJGL_TrustManageEditService.PrintCH_Trust(trust); + // } + // //列表 + // var listStr = new List(); + // listStr.Add(new SqlParameter("@CH_TrustID", CH_TrustID.Value)); + // SqlParameter[] parameter = listStr.ToArray(); + // var tb = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_TrustItem", parameter); + // //头部 + // var listTitleStr = new List(); + // listTitleStr.Add(new SqlParameter("@CH_TrustID", CH_TrustID.Value)); + // SqlParameter[] titleparameter = listTitleStr.ToArray(); + // var tbTitle = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_Trust", titleparameter); + // if (tb.Rows.Count > 0 && tbTitle.Rows.Count > 0) + // { + // var allPageNum = Math.Ceiling((float)tb.Rows.Count / 15); + // var titIsXu = 26; + // for (int i = 1; i <= allPageNum; i++) + // { + // //公共样式 + // ICellStyle style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true); + // //有边框文字居左 + // ICellStyle leftstyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true); + // //有边框文字居中 + // ICellStyle centerstyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 12, true); + // //底部双底虚线 + // ICellStyle doubleLinestyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Double, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true); + // //无边框文字靠左 + // ICellStyle leftNoneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true); + // //无边框文字靠右 + // ICellStyle rightNoneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10, true); + // //头部样式 + // ICellStyle titleStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 11, true, true, "黑体"); + // ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, int.Parse((rowIndex + titIsXu).ToString()), style, 0, 11);//表格列数 + // #region 头部 + // //行0 + // CellRangeAddress region = new CellRangeAddress(rowIndex, rowIndex + 1, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(0).SetCellValue("浙江石油化工有限公司"); + // ws.GetRow(rowIndex).GetCell(0).CellStyle = centerstyle; + // ws.GetRow(rowIndex).GetCell(1).CellStyle = centerstyle; + // ws.GetRow(rowIndex).GetCell(2).CellStyle = centerstyle; + + // region = new CellRangeAddress(rowIndex, rowIndex + 1, 3, 7); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(3).SetCellValue("管道焊缝检测委托单"); + // ws.GetRow(rowIndex).GetCell(3).CellStyle = titleStyle; + // ws.GetRow(rowIndex).GetCell(4).CellStyle = titleStyle; + // ws.GetRow(rowIndex).GetCell(5).CellStyle = titleStyle; + // ws.GetRow(rowIndex).GetCell(6).CellStyle = titleStyle; + // ws.GetRow(rowIndex).GetCell(7).CellStyle = titleStyle; + + // region = new CellRangeAddress(rowIndex, rowIndex, 8, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(8).SetCellValue("工程名称:" + tbTitle.Rows[0]["ProjectName"].ToString()); + // ws.GetRow(rowIndex).GetCell(8).CellStyle = leftstyle; + // ws.GetRow(rowIndex).GetCell(9).CellStyle = leftstyle; + // ws.GetRow(rowIndex).GetCell(10).CellStyle = leftstyle; + // ws.GetRow(rowIndex).GetCell(11).CellStyle = leftstyle; + + // //行1 + // region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 8, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex+1).GetCell(8).SetCellValue("单位工程名称:管道安装"); + // ws.GetRow(rowIndex + 1).GetCell(8).CellStyle = leftstyle; + + // //行2 + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 1); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("装置名称"); + + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 2, 5); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue(tbTitle.Rows[0]["InstallationName"].ToString()); + + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 6, 7); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("装置主项号"); + + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue(tbTitle.Rows[0]["InstallationCode"].ToString()); + + // //行3 + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("委托单位"); + + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 5); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue(tbTitle.Rows[0]["UnitName"].ToString()); + + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 6, 7); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("委托单编号"); + + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 8, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue(tbTitle.Rows[0]["CH_TrustCode"].ToString()); + + // //行4 + // region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("承包商"); + + // ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue("鼎盛石化工程有限公司"); + + // region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 3, 4); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 4).GetCell(3).SetCellValue("检测单位"); + + // region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 6); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue(tbTitle.Rows[0]["CheckUnitName"].ToString()); + + // ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("检件名称"); + + // region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 8, 9); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 4).GetCell(8).SetCellValue("工业管道"); + + // ws.GetRow(rowIndex + 4).GetCell(10).SetCellValue("外观检查"); + + // ws.GetRow(rowIndex + 4).GetCell(11).SetCellValue("合格"); + + // //行5 + // region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 0, 1); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("焊接方法"); + + // ws.GetRow(rowIndex + 5).GetCell(2).SetCellValue(tbTitle.Rows[0]["WME_Code"].ToString()); + + // region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 3, 4); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 5).GetCell(3).SetCellValue("热处理状态"); + + // region = new CellRangeAddress(rowIndex +5, rowIndex + 5, 5, 6); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue(tbTitle.Rows[0]["IsHot"].ToString()); + + // ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("坡口形式"); + + // region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 8, 9); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue(tbTitle.Rows[0]["JST_Name"].ToString()); + + // ws.GetRow(rowIndex + 5).GetCell(10).SetCellValue("检测比例"); + + // ws.GetRow(rowIndex + 5).GetCell(11).SetCellValue(tbTitle.Rows[0]["NDTR_Name"].ToString()); + + // //行6 + // region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 0, 1); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("检测方法"); + + // ws.GetRow(rowIndex + 6).GetCell(2).SetCellValue(tbTitle.Rows[0]["NDT_Code"].ToString()); + + // region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 3, 4); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 6).GetCell(3).SetCellValue("检测时机"); + + // region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 6); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue("焊后"); + + // ws.GetRow(rowIndex + 6).GetCell(7).SetCellValue("技术等级"); + + // region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 8, 9); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 6).GetCell(8).SetCellValue("AB级"); + + // ws.GetRow(rowIndex + 6).GetCell(10).SetCellValue("合格级别"); + + // string acceptGrade = string.Empty; + // if (tbTitle.Rows[0]["NDT_Code"].ToString() == "PT") + // { + // acceptGrade = "Ⅰ"; + // } + // else + // { + // int rate = Funs.GetNewIntOrZero(tbTitle.Rows[0]["NDTR_Name"].ToString()); + // if (tbTitle.Rows[0]["NDT_Code"].ToString() == "RT" && rate < 20) + // { + // acceptGrade = "Ⅲ"; + // } + // else if (tbTitle.Rows[0]["NDT_Code"].ToString() == "RT" && rate >= 20) + // { + // acceptGrade = "Ⅱ"; + // } + // else + // { + // acceptGrade = tbTitle.Rows[0]["AcceptGrade"].ToString(); + // } + // } + // ws.GetRow(rowIndex + 6).GetCell(11).SetCellValue(acceptGrade); + + // //行7 + // region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 0, 1); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("检测标准"); + // string ndtcriterial = string.Empty; + // if (tbTitle.Rows[0]["NDT_Code"].ToString() == "RT") + // { + // ndtcriterial = "NB/T 47013.2-2015"; + // } + // else if (tbTitle.Rows[0]["NDT_Code"].ToString() == "PT") + // { + // ndtcriterial = "NB/T 47013.5-2015"; + // } + // else if (tbTitle.Rows[0]["NDT_Code"].ToString() == "UT") + // { + // ndtcriterial = "NB/T 47013.3-2015"; + // } + // else if (tbTitle.Rows[0]["NDT_Code"].ToString() == "MT") + // { + // ndtcriterial = "NB/T 47013.4-2015"; + // } + // else if (tbTitle.Rows[0]["NDT_Code"].ToString() == "PAUT") + // { + // ndtcriterial = "NB/T 47013.15-2021"; + // } + // else + // { + // ndtcriterial = tbTitle.Rows[0]["CH_NDTCriteria"].ToString(); + // } + // ws.GetRow(rowIndex + 7).GetCell(2).SetCellValue(ndtcriterial); + + // region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 3, 4); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 7).GetCell(3).SetCellValue("检测部位"); + + // region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 5, 6); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 7).GetCell(5).SetCellValue("焊缝"); + + // ws.GetRow(rowIndex + 7).GetCell(7).SetCellValue("焊口总数"); + + // region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 8, 9); + // ws.AddMergedRegion(region); + + // int jointCount = BLL.HJGL_PW_JointInfoService.GetJointCountByIsoId(tb.Rows[0]["ISO_ID"].ToString(), tb.Rows[0]["JOTY_ID"].ToString()); + + // ws.GetRow(rowIndex + 7).GetCell(8).SetCellValue(jointCount.ToString()); + + // ws.GetRow(rowIndex + 7).GetCell(10).SetCellValue("检测数量"); + // ws.GetRow(rowIndex + 7).GetCell(11).SetCellValue((tb.Rows.Count - 1).ToString()); + + // #endregion + + // #region 表格 + // var dataTit = rowIndex + 8; + // //合并单元格 + // for (int hb = dataTit; hb <= rowIndex + titIsXu; hb++) + // { + // region = new CellRangeAddress(hb, hb, 1, 3); + // ws.AddMergedRegion(region); + // region = new CellRangeAddress(hb, hb, 5, 6); + // ws.AddMergedRegion(region); + // region = new CellRangeAddress(hb, hb, 8, 9); + // ws.AddMergedRegion(region); + // } + + // //每页数据开始和结束条数 + // var dStart = i == 1 ? 0 : (i - 1) * 16; + // var dEnd = i * 16; + + // //获取当前页数据 + // var pageTb = GetPageToTable(tb, dStart, dEnd); + + + // //列头 + // ws.GetRow(dataTit).GetCell(0).SetCellValue("序号"); + // ws.GetRow(dataTit).GetCell(1).SetCellValue("管线编号"); + // ws.GetRow(dataTit).GetCell(4).SetCellValue("单线号"); + // ws.GetRow(dataTit).GetCell(5).SetCellValue("焊口编号"); + // ws.GetRow(dataTit).GetCell(7).SetCellValue("焊口规格"); + // ws.GetRow(dataTit).GetCell(8).SetCellValue("材质"); + // ws.GetRow(dataTit).GetCell(10).SetCellValue("焊工号"); + // ws.GetRow(dataTit).GetCell(11).SetCellValue("管道等级"); + + // //数据 + // for (int j = 0; j < pageTb.Rows.Count; j++) + // { + // int dataIndex = dataTit + j + 1; + // ws.GetRow(dataIndex).GetCell(0).SetCellValue(pageTb.Rows[j]["Number"].ToString()); + // ws.GetRow(dataIndex).GetCell(1).SetCellValue(pageTb.Rows[j]["ISO_IsoNo"].ToString()); + // ws.GetRow(dataIndex).GetCell(4).SetCellValue(pageTb.Rows[j]["ISO_Number"].ToString()); + // ws.GetRow(dataIndex).GetCell(5).SetCellValue(pageTb.Rows[j]["JOT_JointNo"].ToString()); + // ws.GetRow(dataIndex).GetCell(7).SetCellValue(pageTb.Rows[j]["JOT_JointDesc"].ToString()); + // ws.GetRow(dataIndex).GetCell(8).SetCellValue(pageTb.Rows[j]["STE_Code"].ToString()); + // ws.GetRow(dataIndex).GetCell(10).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString()); + // ws.GetRow(dataIndex).GetCell(11).SetCellValue(pageTb.Rows[j]["ISC_IsoName"].ToString()); + // } + + // #endregion + + // #region 尾部 + // //尾部样式无线条 + // ICellStyle noneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10); + // var tEnd = int.Parse((rowIndex + titIsXu + 1).ToString()); + // ////创建尾部 + // ws.CreateRow(tEnd); + // ws.CreateRow(tEnd).HeightInPoints = 21f; + // ws.CreateRow(tEnd+1); + // ws.CreateRow(tEnd+1).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 2); + // ws.CreateRow(tEnd + 2).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 3); + // ws.CreateRow(tEnd + 3).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 4); + // ws.CreateRow(tEnd + 4).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 5); + // ws.CreateRow(tEnd + 5).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 6); + // ws.CreateRow(tEnd + 6).HeightInPoints = 21f; + + // for (int eIndex = 0; eIndex <= 12; eIndex++) + // { + // ws.GetRow(tEnd).CreateCell(eIndex); + // ws.GetRow(tEnd).GetCell(eIndex).CellStyle = noneStyle; + // //行1 + // ws.GetRow(tEnd + 1).CreateCell(eIndex); + // ws.GetRow(tEnd + 1).GetCell(eIndex).CellStyle = noneStyle; + // //行2 + // ws.GetRow(tEnd + 2).CreateCell(eIndex); + // ws.GetRow(tEnd + 2).GetCell(eIndex).CellStyle = noneStyle; + // //行3 + // ws.GetRow(tEnd + 3).CreateCell(eIndex); + // ws.GetRow(tEnd + 3).GetCell(eIndex).CellStyle = noneStyle; + // //行4 + // ws.GetRow(tEnd + 4).CreateCell(eIndex); + // ws.GetRow(tEnd + 4).GetCell(eIndex).CellStyle = noneStyle; + // //行5 + // ws.GetRow(tEnd + 5).CreateCell(eIndex); + // ws.GetRow(tEnd + 5).GetCell(eIndex).CellStyle = noneStyle; + // //行6 + // ws.GetRow(tEnd + 6).CreateCell(eIndex); + // ws.GetRow(tEnd + 6).GetCell(eIndex).CellStyle = noneStyle; + // } + + // //尾部样式左侧线条文字靠左 + // ICellStyle leftStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + // //尾部样式右侧线条文字靠左 + // ICellStyle rightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + // //尾部样式上、下、左侧线文字居中 + // ICellStyle topBottomLeftStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10); + // //上、下线文字靠左 + // ICellStyle topBottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + // //上、下、右侧线文字靠左 + // ICellStyle topBottomRightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + // //左、下线文字居左 + // ICellStyle leftBottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + // //下线文字靠左 + // ICellStyle bottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + // //下、右侧线文字靠左 + // ICellStyle bottomRightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10); + + // //尾部行1 + // region = new CellRangeAddress(tEnd, tEnd, 0, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd).GetCell(0).SetCellValue("注:"); + // ws.GetRow(tEnd).GetCell(0).CellStyle = leftStyle; + // ws.GetRow(tEnd).GetCell(11).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 1, tEnd + 1, 0, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 1).GetCell(0).SetCellValue("1、附图 张;"); + // ws.GetRow(tEnd + 1).GetCell(0).CellStyle = leftStyle; + // ws.GetRow(tEnd + 1).GetCell(11).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 2, tEnd + 2, 0, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 2).GetCell(0).SetCellValue("2、需要说明的其他问题:"); + // ws.GetRow(tEnd + 2).GetCell(0).CellStyle = leftStyle; + // ws.GetRow(tEnd + 2).GetCell(11).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 3, tEnd + 3, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 3).GetCell(0).SetCellValue("承包商"); + // ws.GetRow(tEnd + 3).GetCell(0).CellStyle = topBottomLeftStyle; + // ws.GetRow(tEnd + 3).GetCell(1).CellStyle = topBottomStyle; + // ws.GetRow(tEnd + 3).GetCell(2).CellStyle = topBottomRightStyle; + + // region = new CellRangeAddress(tEnd + 3, tEnd + 3, 3, 5); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 3).GetCell(3).SetCellValue("监理单位"); + // ws.GetRow(tEnd + 3).GetCell(3).CellStyle = topBottomLeftStyle; + // ws.GetRow(tEnd + 3).GetCell(4).CellStyle = topBottomStyle; + // ws.GetRow(tEnd + 3).GetCell(5).CellStyle = topBottomRightStyle; + + // region = new CellRangeAddress(tEnd + 3, tEnd + 3, 6, 8); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 3).GetCell(6).SetCellValue("项目部"); + // ws.GetRow(tEnd + 3).GetCell(6).CellStyle = topBottomLeftStyle; + // ws.GetRow(tEnd + 3).GetCell(7).CellStyle = topBottomStyle; + // ws.GetRow(tEnd + 3).GetCell(8).CellStyle = topBottomRightStyle; + + // region = new CellRangeAddress(tEnd + 3, tEnd + 3, 9, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 3).GetCell(9).SetCellValue("检测单位"); + // ws.GetRow(tEnd + 3).GetCell(9).CellStyle = topBottomLeftStyle; + // ws.GetRow(tEnd + 3).GetCell(10).CellStyle = topBottomStyle; + // ws.GetRow(tEnd + 3).GetCell(11).CellStyle = topBottomRightStyle; + + // region = new CellRangeAddress(tEnd + 4, tEnd + 4, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 4).GetCell(0).SetCellValue(""); + // ws.GetRow(tEnd + 4).GetCell(0).CellStyle = leftStyle; + // ws.GetRow(tEnd + 4).GetCell(2).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 4, tEnd + 4, 3, 5); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 4).GetCell(3).SetCellValue(""); + // ws.GetRow(tEnd + 4).GetCell(3).CellStyle = leftStyle; + // ws.GetRow(tEnd + 4).GetCell(5).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 4, tEnd + 4, 6, 8); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 4).GetCell(6).SetCellValue(""); + // ws.GetRow(tEnd + 4).GetCell(6).CellStyle = leftStyle; + // ws.GetRow(tEnd + 4).GetCell(8).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 4, tEnd + 4, 9, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 4).GetCell(9).SetCellValue(""); + // ws.GetRow(tEnd + 4).GetCell(9).CellStyle = leftStyle; + // ws.GetRow(tEnd + 4).GetCell(11).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 5, tEnd + 5, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 5).GetCell(0).SetCellValue("签字:"); + // ws.GetRow(tEnd + 5).GetCell(0).CellStyle = leftStyle; + // ws.GetRow(tEnd + 5).GetCell(2).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 5, tEnd + 5, 3, 5); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 5).GetCell(3).SetCellValue("签字:"); + // ws.GetRow(tEnd + 5).GetCell(3).CellStyle = leftStyle; + // ws.GetRow(tEnd + 5).GetCell(5).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 5, tEnd + 5, 6, 8); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 5).GetCell(6).SetCellValue("签字:"); + // ws.GetRow(tEnd + 5).GetCell(6).CellStyle = leftStyle; + // ws.GetRow(tEnd + 5).GetCell(8).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 5, tEnd + 5, 9, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 5).GetCell(9).SetCellValue("签字:"); + // ws.GetRow(tEnd + 5).GetCell(9).CellStyle = leftStyle; + // ws.GetRow(tEnd + 5).GetCell(11).CellStyle = rightStyle; + + // region = new CellRangeAddress(tEnd + 6, tEnd + 6, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 6).GetCell(0).SetCellValue("日期:"); + // ws.GetRow(tEnd + 6).GetCell(0).CellStyle = leftBottomStyle; + // ws.GetRow(tEnd + 6).GetCell(1).CellStyle = bottomStyle; + // ws.GetRow(tEnd + 6).GetCell(2).CellStyle = bottomRightStyle; + + // region = new CellRangeAddress(tEnd + 6, tEnd + 6, 3, 5); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 6).GetCell(3).SetCellValue("日期:"); + // ws.GetRow(tEnd + 6).GetCell(3).CellStyle = leftBottomStyle; + // ws.GetRow(tEnd + 6).GetCell(4).CellStyle = bottomStyle; + // ws.GetRow(tEnd + 6).GetCell(5).CellStyle = bottomRightStyle; + + // region = new CellRangeAddress(tEnd + 6, tEnd + 6, 6, 8); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 6).GetCell(6).SetCellValue("日期:"); + // ws.GetRow(tEnd + 6).GetCell(6).CellStyle = leftBottomStyle; + // ws.GetRow(tEnd + 6).GetCell(7).CellStyle = bottomStyle; + // ws.GetRow(tEnd + 6).GetCell(8).CellStyle = bottomRightStyle; + + // region = new CellRangeAddress(tEnd + 6, tEnd + 6, 9, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 6).GetCell(9).SetCellValue("日期:"); + // ws.GetRow(tEnd + 6).GetCell(9).CellStyle = leftBottomStyle; + // ws.GetRow(tEnd + 6).GetCell(10).CellStyle = bottomStyle; + // ws.GetRow(tEnd + 6).GetCell(11).CellStyle = bottomRightStyle; + + // #endregion + + // rowIndex += int.Parse((titIsXu + 8).ToString()); + // } + // } + // } + // } + + // ws.SetMargin(MarginType.LeftMargin, 0.7); + // ws.SetMargin(MarginType.RightMargin, 0.5); + + // ws.PrintSetup.Landscape = false; + // ws.PrintSetup.PaperSize = 9; + + // ws.ForceFormulaRecalculation = true; + // using (FileStream filess = File.OpenWrite(ReportFileName)) + // { + // hssfworkbook.Write(filess); + // } + // FileInfo filet = new FileInfo(ReportFileName); + // Response.Clear(); + // Response.Charset = "GB2312"; + // Response.ContentEncoding = System.Text.Encoding.UTF8; + // // 添加头信息,为"文件下载/另存为"对话框指定默认文件名 + // Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode("检测委托单.xlsx")); + // // 添加头信息,指定文件大小,让浏览器能够显示下载进度 + // Response.AddHeader("Content-Length", filet.Length.ToString()); + // // 指定返回的是一个不能被客户端读取的流,必须被下载 + // Response.ContentType = "application/ms-excel"; + // // 把文件流发送到客户端 + // Response.WriteFile(filet.FullName); + // // 停止页面的执行 + // Response.End(); + //} + #endregion } #endregion diff --git a/HJGL_DS/FineUIPro.Web/ContinuousPrint/WeldingJointInspection.aspx.cs b/HJGL_DS/FineUIPro.Web/ContinuousPrint/WeldingJointInspection.aspx.cs index abaaca2..a09a319 100644 --- a/HJGL_DS/FineUIPro.Web/ContinuousPrint/WeldingJointInspection.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/ContinuousPrint/WeldingJointInspection.aspx.cs @@ -171,44 +171,12 @@ namespace FineUIPro.Web.ContinuousPrint Alert.ShowInTop("最少选中一行!", MessageBoxIcon.Warning); return; } - string rootPath = Server.MapPath("~/") + Const.ExcelUrl; - //导出文件 - string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\"; - if (!Directory.Exists(filePath)) - { - Directory.CreateDirectory(filePath); - } - string ReportFileName = filePath + "out.xlsx"; + string initTemplatePath = ""; + string rootPath = Server.MapPath("~/"); + BLL.Common.FastReportService.ResetData(); + if (Grid2.Rows.Count > 0) { - int rowIndex = 0; - XSSFWorkbook hssfworkbook = new XSSFWorkbook(); - XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("管道焊接接头报检检查记录"); - - #region 列宽 - ws.SetColumnWidth(0, (5 * 256) - 15);//(4.33)4.36 - ws.SetColumnWidth(1, (6 * 256) - 95);//(5.08)5.09 - ws.SetColumnWidth(2, (7 * 256) - 95);//(6.08)6.09 - ws.SetColumnWidth(3, (7 * 256) - 95);//(5.08)6.09 - ws.SetColumnWidth(4, (6 * 256) - 95);//(5.08)5.09 - ws.SetColumnWidth(5, (4 * 256) + 120);//(3.92)3.91 - ws.SetColumnWidth(6, (6 * 256) - 95);//(5.08)5.09 - ws.SetColumnWidth(7, (4 * 256) + 60);//(3.67)3.64 - ws.SetColumnWidth(8, (16 * 256) - 95);//(15.08)15.09 - ws.SetColumnWidth(9, (7 * 256) - 95);//(6.08)6.09 - ws.SetColumnWidth(10, (7 * 256) - 95);//(6.08)6.09 - ws.SetColumnWidth(11, (6 * 256) - 95);//(5.08)5.09 - ws.SetColumnWidth(12, (11 * 256) - 95);//(10.08)10.09 - ws.SetColumnWidth(13, (8 * 256) - 95);//(7.08)7.09 - ws.SetColumnWidth(14, (6 * 256) - 95);//(5.08)5.09 - ws.SetColumnWidth(15, (8 * 256) + 55);//(7.67)7.64 - ws.SetColumnWidth(16, (4 * 256) - 15);//(3.33)3.36 - ws.SetColumnWidth(17, (8 * 256) + 50);//(7.58)7.64 - ws.SetColumnWidth(18, (9 * 256) - 15);//(8.33)8.36 - ws.SetColumnWidth(19, (8 * 256) + 50);//(7.58)7.64 - ws.SetColumnWidth(20, (3 * 256) + 50);//(2.58)2.64 - #endregion - for (int gi = 0; gi < Grid2.Rows.Count; gi++) { if (Grid2.SelectedRowIndexArray.Contains(gi)) @@ -218,6 +186,7 @@ namespace FineUIPro.Web.ContinuousPrint System.Web.UI.WebControls.HiddenField hidJOTY_Group = Grid2.Rows[gi].FindControl("hidJOTY_Group") as System.Web.UI.WebControls.HiddenField; System.Web.UI.WebControls.HiddenField hidVICheckDate = Grid2.Rows[gi].FindControl("hidVICheckDate") as System.Web.UI.WebControls.HiddenField; System.Web.UI.WebControls.HiddenField hidProjectName = Grid2.Rows[gi].FindControl("hidProjectName") as System.Web.UI.WebControls.HiddenField; + var listStr = new List(); listStr.Add(new SqlParameter("@ProjectId", hidProjectId.Value)); listStr.Add(new SqlParameter("@NDTR_ID", hidNDTR_ID.Value)); @@ -226,380 +195,506 @@ namespace FineUIPro.Web.ContinuousPrint SqlParameter[] parameter = listStr.ToArray(); var tb = SQLHelper.GetDataTableRunProc("HJGL_sp_WeldInspectionCheckRecordNew", parameter); - if (tb.Rows.Count > 0) + + DataTable dt2 = new DataTable(); + dt2.TableName = "Data"; + dt2.Columns.Add("Number"); + dt2.Columns.Add("ISO_IsoNo"); + dt2.Columns.Add("JOT_JointNo"); + dt2.Columns.Add("WED_Code"); + dt2.Columns.Add("JOT_JointDesc"); + dt2.Columns.Add("STE_Code"); + dt2.Columns.Add("JOT_Location"); + dt2.Columns.Add("WME_Name"); + dt2.Columns.Add("WMT_MatName"); + dt2.Columns.Add("JOT_PrepareTemp"); + dt2.Columns.Add("PassVI"); + dt2.Columns.Add("NoPassVI"); + dt2.Columns.Add("Remark"); + + DataView dv = tb.DefaultView;//获取表视图 + dv.Sort = "ISO_IsoNo,JOT_JointNo ASC";//按照ID倒序排序 + tb = dv.ToTable();//转为表 + DataRow[] rows2 = tb.DefaultView.ToTable().Select(); + int i = 0; + foreach (var row in rows2) { - //tb.Columns.Add("index", typeof(System.Int32)); - //foreach (DataRow row in tb.Rows) - //{ - // try - // { - // row["index"] = int.Parse(System.Text.RegularExpressions.Regex.Replace(row["JOT_JointNo"].ToString(), @"[^0-9]+", "")); - // } - // catch (Exception ex) - // { - // row["index"] = 0; - // } - //} - //DataView dv = tb.DefaultView;//获取表视图 - //dv.Sort = "index ASC";//按照ID倒序排序 - //tb = dv.ToTable();//转为表 + var newRows = dt2.NewRow(); + newRows["Number"] = (i + 1).ToString(); + newRows["ISO_IsoNo"] = row["ISO_IsoNo"].ToString(); + newRows["JOT_JointNo"] = row["JOT_JointNo"].ToString(); + newRows["WED_Code"] = row["WED_Code"].ToString(); + newRows["JOT_JointDesc"] = row["JOT_JointDesc"].ToString(); + newRows["STE_Code"] = row["STE_Code"].ToString(); + newRows["JOT_Location"] = row["JOT_Location"].ToString(); + newRows["WME_Name"] = row["WME_Name"].ToString(); + newRows["WMT_MatName"] = row["WMT_MatName"].ToString(); + newRows["JOT_PrepareTemp"] = row["JOT_PrepareTemp"].ToString(); + newRows["PassVI"] = row["PassVI"].ToString(); + newRows["NoPassVI"] = row["NoPassVI"].ToString(); + newRows["Remark"] = row["Remark"].ToString(); - CellRangeAddress region; - //尾页面总数 - var pageNum = 0d; - //尾部增加行 - var endaddNum = 0; - //公共样式 - ICellStyle style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 11, true); - //头部样式 - ICellStyle styleTou = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 16, true, true); - //文字靠左 - ICellStyle styleFontLeft = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 11, true); - //文字靠左,左侧无边框 - ICellStyle styleFontLeftNone = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 11, true); - //右侧无边框 - ICellStyle styleRightNone = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 11, true); - //计算页 - pageNum = tb.Rows.Count < 11 ? 1 : Math.Ceiling((float)(tb.Rows.Count - 11) / 11) + 1; - //循环页 - for (int i = 1; i <= pageNum; i++) - { - //取数据开始和结束条数 - var dStart = 0; - var dEnd = 0; - //excel数据开始行和结束行 - var tStart = 0; - var tEnd = 0; + dt2.Rows.Add(newRows); + i++; + } + BLL.Common.FastReportService.AddFastreportTable(dt2); + //传参 + Dictionary keyValuePairs = new Dictionary(); + keyValuePairs.Add("ProjectName", hidProjectName.Value); + keyValuePairs.Add("InspectionCount", tb.Rows.Count.ToString()); + keyValuePairs.Add("NDTRName", "100%"); + if (hidJOTY_Group.Value=="1") + { + keyValuePairs.Add("NDTType", "RT"); + } + else + { + keyValuePairs.Add("NDTType", "PT"); + } + BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs); - #region 头部和每页数据参数 - //第一页和第二页需要创建头 - if (i == 1) - { - //尾部增加行 - endaddNum = 5; - //创建头部行和列 - ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 4, style, 0, 20); - //取数据开始和结束条数 - dStart = 0; - dEnd = 11; - //excel数据开始行和结束行 - tStart = rowIndex + 5; - tEnd = rowIndex + 15; + initTemplatePath = "File\\Fastreport\\管道焊接接头报检检查记录.frx"; - #region 头部 - //行1 - region = new CellRangeAddress(rowIndex, rowIndex + 1, 0, 4); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3543—G402"); - region = new CellRangeAddress(rowIndex, rowIndex + 1, 5, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(5).SetCellValue("管道焊接接头报检/检查记录"); - ws.GetRow(rowIndex).GetCell(5).CellStyle = styleTou; - region = new CellRangeAddress(rowIndex, rowIndex, 14, 16); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(14).SetCellValue("工程名称:"); - ws.GetRow(rowIndex).GetCell(14).CellStyle = ws.GetRow(rowIndex).GetCell(15).CellStyle = ws.GetRow(rowIndex).GetCell(16).CellStyle = styleRightNone; - region = new CellRangeAddress(rowIndex, rowIndex, 17, 20); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(17).SetCellValue(hidProjectName.Value); - ws.GetRow(rowIndex).GetCell(17).CellStyle = styleFontLeftNone; - //行2 - region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 14, 16); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 1).GetCell(14).SetCellValue("单位工程名称:"); - ws.GetRow(rowIndex + 1).GetCell(14).CellStyle = ws.GetRow(rowIndex + 1).GetCell(15).CellStyle = ws.GetRow(rowIndex + 1).GetCell(16).CellStyle = styleRightNone; - region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 20); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 1).GetCell(17).SetCellValue("管道"); - ws.GetRow(rowIndex + 1).GetCell(17).CellStyle = styleFontLeftNone; - //行3 - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("报检/检查记录编号"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 3, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue(""); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 7, 9); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("无损检测方法"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 10, 12); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue(""); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 13, 14); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(13).SetCellValue("报检数量"); - ws.GetRow(rowIndex + 2).GetCell(15).SetCellValue(tb.Rows.Count.ToString()); - ws.GetRow(rowIndex + 2).GetCell(16).SetCellValue("个"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 17, 18); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(17).SetCellValue("检测比例"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 19, 20); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(19).SetCellValue("100%"); - //行4-5,列头 - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 0, 0); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("序号"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 1, 3); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(1).SetCellValue("管道编号/单线号"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 4, 5); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("焊口编号"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 6, 7); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("焊工代号"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 8, 8); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue("规格 mm"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 9, 10); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue("材质"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 11, 11); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(11).SetCellValue("焊接位置"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 12, 12); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(12).SetCellValue("焊接方法"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 13, 14); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(13).SetCellValue("焊材牌号"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 15, 16); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(15).SetCellValue("实际预热温度℃"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 17, 18); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(17).SetCellValue("焊缝外观检查"); - ws.GetRow(rowIndex + 4).GetCell(17).SetCellValue("□合格"); - ws.GetRow(rowIndex + 4).GetCell(18).SetCellValue("□不合格"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 19, 20); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(19).SetCellValue("备注"); - #endregion + if (File.Exists(rootPath + initTemplatePath)) + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../common/ReportPrint/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); - } - else - { - //尾部增加行 - endaddNum = 5; - //创建头部行和列 - ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 4, style, 0, 20); - - var pNum = (i - 1) * 11; - //取数据开始和结束条数 - dStart = 11 + ((i - 2) * 11); - dEnd = 11 + pNum; - //数据开始行和结束行 - tStart = rowIndex + 5; - tEnd = rowIndex + 15; - - #region 头部 - //行1 - region = new CellRangeAddress(rowIndex, rowIndex + 1, 0, 4); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3543—G402"); - region = new CellRangeAddress(rowIndex, rowIndex + 1, 5, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(5).SetCellValue("管道焊接接头报检/检查记录"); - ws.GetRow(rowIndex).GetCell(5).CellStyle = styleTou; - region = new CellRangeAddress(rowIndex, rowIndex, 14, 16); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(14).SetCellValue("工程名称:"); - ws.GetRow(rowIndex).GetCell(14).CellStyle = ws.GetRow(rowIndex).GetCell(15).CellStyle = ws.GetRow(rowIndex).GetCell(16).CellStyle = styleRightNone; - region = new CellRangeAddress(rowIndex, rowIndex, 17, 20); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(17).SetCellValue(hidProjectName.Value); - ws.GetRow(rowIndex).GetCell(17).CellStyle = styleFontLeftNone; - //行2 - region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 14, 16); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 1).GetCell(14).SetCellValue("单位工程名称:"); - ws.GetRow(rowIndex + 1).GetCell(14).CellStyle = ws.GetRow(rowIndex + 1).GetCell(15).CellStyle = ws.GetRow(rowIndex + 1).GetCell(16).CellStyle = styleRightNone; - region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 20); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 1).GetCell(17).SetCellValue("管道"); - ws.GetRow(rowIndex + 1).GetCell(17).CellStyle = styleFontLeftNone; - //行3 - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("报检/检查记录编号"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 3, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue(""); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 7, 9); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("无损检测方法"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 10, 12); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue(""); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 13, 14); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(13).SetCellValue("报检数量"); - ws.GetRow(rowIndex + 2).GetCell(15).SetCellValue(tb.Rows.Count.ToString()); - ws.GetRow(rowIndex + 2).GetCell(16).SetCellValue("个"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 17, 18); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(17).SetCellValue("检测比例"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 19, 20); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(19).SetCellValue("100%"); - //行4-5,列头 - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 0, 0); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("序号"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 1, 3); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(1).SetCellValue("管道编号/单线号"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 4, 5); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("焊口编号"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 6, 7); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("焊工代号"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 8, 8); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue("规格 mm"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 9, 10); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue("材质"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 11, 11); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(11).SetCellValue("焊接位置"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 12, 12); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(12).SetCellValue("焊接方法"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 13, 14); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(13).SetCellValue("焊材牌号"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 15, 16); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(15).SetCellValue("实际预热温度℃"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 17, 18); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(17).SetCellValue("焊缝外观检查"); - ws.GetRow(rowIndex + 4).GetCell(17).SetCellValue("□合格"); - ws.GetRow(rowIndex + 4).GetCell(18).SetCellValue("□不合格"); - region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 19, 20); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(19).SetCellValue("备注"); - #endregion - } - #endregion - - #region 数据 - //创建数据行和列 - ws = ExcelCreateRow(ws, hssfworkbook, tStart, tEnd, style, 0, 20); - //获取当前页数据 - var pageTb = GetPageToTable(tb, dStart, dEnd); - //数据 - for (int j = 0; j < pageTb.Rows.Count; j++) - { - var number = dStart == 0 ? j + 1 : dStart + 1 + j; - int dataIndex = tStart + j; - ws.GetRow(dataIndex).GetCell(0).SetCellValue(number); - ws.GetRow(dataIndex).GetCell(1).SetCellValue(pageTb.Rows[j]["ISO_IsoNo"].ToString()); - ws.GetRow(dataIndex).GetCell(4).SetCellValue(pageTb.Rows[j]["JOT_JointNo"].ToString()); - ws.GetRow(dataIndex).GetCell(6).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString()); - ws.GetRow(dataIndex).GetCell(8).SetCellValue(pageTb.Rows[j]["JOT_JointDesc"].ToString()); - ws.GetRow(dataIndex).GetCell(9).SetCellValue(pageTb.Rows[j]["STE_Code"].ToString()); - ws.GetRow(dataIndex).GetCell(11).SetCellValue(pageTb.Rows[j]["JOT_Location"].ToString()); - ws.GetRow(dataIndex).GetCell(12).SetCellValue(pageTb.Rows[j]["WME_Name"].ToString()); - ws.GetRow(dataIndex).GetCell(13).SetCellValue(pageTb.Rows[j]["WMT_MatName"].ToString()); - ws.GetRow(dataIndex).GetCell(15).SetCellValue(pageTb.Rows[j]["JOT_PrepareTemp"].ToString()); - ws.GetRow(dataIndex).GetCell(17).SetCellValue(pageTb.Rows[j]["PassVI"].ToString()); - ws.GetRow(dataIndex).GetCell(18).SetCellValue(pageTb.Rows[j]["NoPassVI"].ToString()); - ws.GetRow(dataIndex).GetCell(19).SetCellValue(pageTb.Rows[j]["Remark"].ToString()); - } - #endregion - - #region 尾部 - var tailIndex = tEnd + 1; - //创建尾部行 - ws.CreateRow(tailIndex); - ws.CreateRow(tailIndex).HeightInPoints = 23f; - ws.CreateRow(tailIndex + 1); - ws.CreateRow(tailIndex + 1).HeightInPoints = 23f; - for (int eIndex = 0; eIndex <= 20; eIndex++) - { - //行1 - ws.GetRow(tailIndex).CreateCell(eIndex); - ws.GetRow(tailIndex).GetCell(eIndex).CellStyle = styleFontLeft; - //行2 - ws.GetRow(tailIndex + 1).CreateCell(eIndex); - ws.GetRow(tailIndex + 1).GetCell(eIndex).CellStyle = styleFontLeft; - } - //尾部行1 - region = new CellRangeAddress(tailIndex, tailIndex, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(tailIndex).GetCell(0).SetCellValue("施工班组长:"); - ws.GetRow(tailIndex).GetCell(0).CellStyle = styleFontLeft; - region = new CellRangeAddress(tailIndex, tailIndex, 3, 10); - ws.AddMergedRegion(region); - ws.GetRow(tailIndex).GetCell(3).SetCellValue(""); - ws.GetRow(tailIndex).GetCell(3).CellStyle = styleFontLeft; - region = new CellRangeAddress(tailIndex, tailIndex, 11, 12); - ws.AddMergedRegion(region); - ws.GetRow(tailIndex).GetCell(11).SetCellValue("质量检查员:"); - ws.GetRow(tailIndex).GetCell(11).CellStyle = styleFontLeft; - region = new CellRangeAddress(tailIndex, tailIndex, 13, 20); - ws.AddMergedRegion(region); - ws.GetRow(tailIndex).GetCell(13).SetCellValue(""); - ws.GetRow(tailIndex).GetCell(13).CellStyle = styleFontLeft; - - //尾部行2 - region = new CellRangeAddress(tailIndex + 1, tailIndex + 1, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(tailIndex + 1).GetCell(0).SetCellValue("日期:"); - ws.GetRow(tailIndex + 1).GetCell(0).CellStyle = styleFontLeft; - region = new CellRangeAddress(tailIndex + 1, tailIndex + 1, 3, 10); - ws.AddMergedRegion(region); - ws.GetRow(tailIndex + 1).GetCell(3).SetCellValue(""); - ws.GetRow(tailIndex + 1).GetCell(3).CellStyle = styleFontLeft; - region = new CellRangeAddress(tailIndex + 1, tailIndex + 1, 11, 12); - ws.AddMergedRegion(region); - ws.GetRow(tailIndex + 1).GetCell(11).SetCellValue("日期:"); - ws.GetRow(tailIndex + 1).GetCell(11).CellStyle = styleFontLeft; - region = new CellRangeAddress(tailIndex + 1, tailIndex + 1, 13, 20); - ws.AddMergedRegion(region); - ws.GetRow(tailIndex + 1).GetCell(13).SetCellValue(""); - ws.GetRow(tailIndex + 1).GetCell(13).CellStyle = styleFontLeft; - #endregion - - rowIndex = tEnd + endaddNum; - } } } } - - ws.SetMargin(MarginType.LeftMargin, 0.1); - ws.SetMargin(MarginType.RightMargin, 0); - - //ws.SetMargin(MarginType.BottomMargin, 1.2); - //ws.SetMargin(MarginType.TopMargin, 1.2); - - ws.PrintSetup.Landscape = true; - ws.PrintSetup.PaperSize = 9; - - ws.ForceFormulaRecalculation = true; - using (FileStream filess = File.OpenWrite(ReportFileName)) - { - hssfworkbook.Write(filess); - } - FileInfo filet = new FileInfo(ReportFileName); - Response.Clear(); - Response.Charset = "GB2312"; - Response.ContentEncoding = System.Text.Encoding.UTF8; - // 添加头信息,为"文件下载/另存为"对话框指定默认文件名 - Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode("管道焊接接头报检检查记录.xlsx")); - // 添加头信息,指定文件大小,让浏览器能够显示下载进度 - Response.AddHeader("Content-Length", filet.Length.ToString()); - // 指定返回的是一个不能被客户端读取的流,必须被下载 - Response.ContentType = "application/ms-excel"; - // 把文件流发送到客户端 - Response.WriteFile(filet.FullName); - // 停止页面的执行 - Response.End(); } + + #region 导出excel,不用了 + //string rootPath = Server.MapPath("~/") + Const.ExcelUrl; + ////导出文件 + //string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\"; + //if (!Directory.Exists(filePath)) + //{ + // Directory.CreateDirectory(filePath); + //} + //string ReportFileName = filePath + "out.xlsx"; + //if (Grid2.Rows.Count > 0) + //{ + // int rowIndex = 0; + // XSSFWorkbook hssfworkbook = new XSSFWorkbook(); + // XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("管道焊接接头报检检查记录"); + + // #region 列宽 + // ws.SetColumnWidth(0, (5 * 256) - 15);//(4.33)4.36 + // ws.SetColumnWidth(1, (6 * 256) - 95);//(5.08)5.09 + // ws.SetColumnWidth(2, (7 * 256) - 95);//(6.08)6.09 + // ws.SetColumnWidth(3, (7 * 256) - 95);//(5.08)6.09 + // ws.SetColumnWidth(4, (6 * 256) - 95);//(5.08)5.09 + // ws.SetColumnWidth(5, (4 * 256) + 120);//(3.92)3.91 + // ws.SetColumnWidth(6, (6 * 256) - 95);//(5.08)5.09 + // ws.SetColumnWidth(7, (4 * 256) + 60);//(3.67)3.64 + // ws.SetColumnWidth(8, (16 * 256) - 95);//(15.08)15.09 + // ws.SetColumnWidth(9, (7 * 256) - 95);//(6.08)6.09 + // ws.SetColumnWidth(10, (7 * 256) - 95);//(6.08)6.09 + // ws.SetColumnWidth(11, (6 * 256) - 95);//(5.08)5.09 + // ws.SetColumnWidth(12, (11 * 256) - 95);//(10.08)10.09 + // ws.SetColumnWidth(13, (8 * 256) - 95);//(7.08)7.09 + // ws.SetColumnWidth(14, (6 * 256) - 95);//(5.08)5.09 + // ws.SetColumnWidth(15, (8 * 256) + 55);//(7.67)7.64 + // ws.SetColumnWidth(16, (4 * 256) - 15);//(3.33)3.36 + // ws.SetColumnWidth(17, (8 * 256) + 50);//(7.58)7.64 + // ws.SetColumnWidth(18, (9 * 256) - 15);//(8.33)8.36 + // ws.SetColumnWidth(19, (8 * 256) + 50);//(7.58)7.64 + // ws.SetColumnWidth(20, (3 * 256) + 50);//(2.58)2.64 + // #endregion + + // for (int gi = 0; gi < Grid2.Rows.Count; gi++) + // { + // if (Grid2.SelectedRowIndexArray.Contains(gi)) + // { + // System.Web.UI.WebControls.HiddenField hidProjectId = Grid2.Rows[gi].FindControl("hidProjectId") as System.Web.UI.WebControls.HiddenField; + // System.Web.UI.WebControls.HiddenField hidNDTR_ID = Grid2.Rows[gi].FindControl("hidNDTR_ID") as System.Web.UI.WebControls.HiddenField; + // System.Web.UI.WebControls.HiddenField hidJOTY_Group = Grid2.Rows[gi].FindControl("hidJOTY_Group") as System.Web.UI.WebControls.HiddenField; + // System.Web.UI.WebControls.HiddenField hidVICheckDate = Grid2.Rows[gi].FindControl("hidVICheckDate") as System.Web.UI.WebControls.HiddenField; + // System.Web.UI.WebControls.HiddenField hidProjectName = Grid2.Rows[gi].FindControl("hidProjectName") as System.Web.UI.WebControls.HiddenField; + // var listStr = new List(); + // listStr.Add(new SqlParameter("@ProjectId", hidProjectId.Value)); + // listStr.Add(new SqlParameter("@NDTR_ID", hidNDTR_ID.Value)); + // listStr.Add(new SqlParameter("@JOTY_Group", hidJOTY_Group.Value)); + // listStr.Add(new SqlParameter("@VICheckDate", hidVICheckDate.Value)); + + // SqlParameter[] parameter = listStr.ToArray(); + // var tb = SQLHelper.GetDataTableRunProc("HJGL_sp_WeldInspectionCheckRecordNew", parameter); + // if (tb.Rows.Count > 0) + // { + // //tb.Columns.Add("index", typeof(System.Int32)); + // //foreach (DataRow row in tb.Rows) + // //{ + // // try + // // { + // // row["index"] = int.Parse(System.Text.RegularExpressions.Regex.Replace(row["JOT_JointNo"].ToString(), @"[^0-9]+", "")); + // // } + // // catch (Exception ex) + // // { + // // row["index"] = 0; + // // } + // //} + // //DataView dv = tb.DefaultView;//获取表视图 + // //dv.Sort = "index ASC";//按照ID倒序排序 + // //tb = dv.ToTable();//转为表 + + // CellRangeAddress region; + // //尾页面总数 + // var pageNum = 0d; + // //尾部增加行 + // var endaddNum = 0; + // //公共样式 + // ICellStyle style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 11, true); + // //头部样式 + // ICellStyle styleTou = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 16, true, true); + // //文字靠左 + // ICellStyle styleFontLeft = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 11, true); + // //文字靠左,左侧无边框 + // ICellStyle styleFontLeftNone = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 11, true); + // //右侧无边框 + // ICellStyle styleRightNone = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 11, true); + // //计算页 + // pageNum = tb.Rows.Count < 11 ? 1 : Math.Ceiling((float)(tb.Rows.Count - 11) / 11) + 1; + // //循环页 + // for (int i = 1; i <= pageNum; i++) + // { + // //取数据开始和结束条数 + // var dStart = 0; + // var dEnd = 0; + // //excel数据开始行和结束行 + // var tStart = 0; + // var tEnd = 0; + + // #region 头部和每页数据参数 + // //第一页和第二页需要创建头 + // if (i == 1) + // { + // //尾部增加行 + // endaddNum = 5; + // //创建头部行和列 + // ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 4, style, 0, 20); + // //取数据开始和结束条数 + // dStart = 0; + // dEnd = 11; + // //excel数据开始行和结束行 + // tStart = rowIndex + 5; + // tEnd = rowIndex + 15; + + // #region 头部 + // //行1 + // region = new CellRangeAddress(rowIndex, rowIndex + 1, 0, 4); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3543—G402"); + // region = new CellRangeAddress(rowIndex, rowIndex + 1, 5, 13); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(5).SetCellValue("管道焊接接头报检/检查记录"); + // ws.GetRow(rowIndex).GetCell(5).CellStyle = styleTou; + // region = new CellRangeAddress(rowIndex, rowIndex, 14, 16); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(14).SetCellValue("工程名称:"); + // ws.GetRow(rowIndex).GetCell(14).CellStyle = ws.GetRow(rowIndex).GetCell(15).CellStyle = ws.GetRow(rowIndex).GetCell(16).CellStyle = styleRightNone; + // region = new CellRangeAddress(rowIndex, rowIndex, 17, 20); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(17).SetCellValue(hidProjectName.Value); + // ws.GetRow(rowIndex).GetCell(17).CellStyle = styleFontLeftNone; + // //行2 + // region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 14, 16); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 1).GetCell(14).SetCellValue("单位工程名称:"); + // ws.GetRow(rowIndex + 1).GetCell(14).CellStyle = ws.GetRow(rowIndex + 1).GetCell(15).CellStyle = ws.GetRow(rowIndex + 1).GetCell(16).CellStyle = styleRightNone; + // region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 20); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 1).GetCell(17).SetCellValue("管道"); + // ws.GetRow(rowIndex + 1).GetCell(17).CellStyle = styleFontLeftNone; + // //行3 + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("报检/检查记录编号"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 3, 6); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue(""); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 7, 9); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("无损检测方法"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 10, 12); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue(""); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 13, 14); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(13).SetCellValue("报检数量"); + // ws.GetRow(rowIndex + 2).GetCell(15).SetCellValue(tb.Rows.Count.ToString()); + // ws.GetRow(rowIndex + 2).GetCell(16).SetCellValue("个"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 17, 18); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(17).SetCellValue("检测比例"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 19, 20); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(19).SetCellValue("100%"); + // //行4-5,列头 + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 0, 0); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("序号"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 1, 3); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(1).SetCellValue("管道编号/单线号"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 4, 5); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("焊口编号"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 6, 7); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("焊工代号"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 8, 8); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue("规格 mm"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 9, 10); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue("材质"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 11, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(11).SetCellValue("焊接位置"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 12, 12); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(12).SetCellValue("焊接方法"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 13, 14); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(13).SetCellValue("焊材牌号"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 15, 16); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(15).SetCellValue("实际预热温度℃"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 17, 18); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(17).SetCellValue("焊缝外观检查"); + // ws.GetRow(rowIndex + 4).GetCell(17).SetCellValue("□合格"); + // ws.GetRow(rowIndex + 4).GetCell(18).SetCellValue("□不合格"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 19, 20); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(19).SetCellValue("备注"); + // #endregion + + // } + // else + // { + // //尾部增加行 + // endaddNum = 5; + // //创建头部行和列 + // ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 4, style, 0, 20); + + // var pNum = (i - 1) * 11; + // //取数据开始和结束条数 + // dStart = 11 + ((i - 2) * 11); + // dEnd = 11 + pNum; + // //数据开始行和结束行 + // tStart = rowIndex + 5; + // tEnd = rowIndex + 15; + + // #region 头部 + // //行1 + // region = new CellRangeAddress(rowIndex, rowIndex + 1, 0, 4); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3543—G402"); + // region = new CellRangeAddress(rowIndex, rowIndex + 1, 5, 13); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(5).SetCellValue("管道焊接接头报检/检查记录"); + // ws.GetRow(rowIndex).GetCell(5).CellStyle = styleTou; + // region = new CellRangeAddress(rowIndex, rowIndex, 14, 16); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(14).SetCellValue("工程名称:"); + // ws.GetRow(rowIndex).GetCell(14).CellStyle = ws.GetRow(rowIndex).GetCell(15).CellStyle = ws.GetRow(rowIndex).GetCell(16).CellStyle = styleRightNone; + // region = new CellRangeAddress(rowIndex, rowIndex, 17, 20); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(17).SetCellValue(hidProjectName.Value); + // ws.GetRow(rowIndex).GetCell(17).CellStyle = styleFontLeftNone; + // //行2 + // region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 14, 16); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 1).GetCell(14).SetCellValue("单位工程名称:"); + // ws.GetRow(rowIndex + 1).GetCell(14).CellStyle = ws.GetRow(rowIndex + 1).GetCell(15).CellStyle = ws.GetRow(rowIndex + 1).GetCell(16).CellStyle = styleRightNone; + // region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 20); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 1).GetCell(17).SetCellValue("管道"); + // ws.GetRow(rowIndex + 1).GetCell(17).CellStyle = styleFontLeftNone; + // //行3 + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("报检/检查记录编号"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 3, 6); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue(""); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 7, 9); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("无损检测方法"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 10, 12); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue(""); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 13, 14); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(13).SetCellValue("报检数量"); + // ws.GetRow(rowIndex + 2).GetCell(15).SetCellValue(tb.Rows.Count.ToString()); + // ws.GetRow(rowIndex + 2).GetCell(16).SetCellValue("个"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 17, 18); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(17).SetCellValue("检测比例"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 19, 20); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(19).SetCellValue("100%"); + // //行4-5,列头 + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 0, 0); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("序号"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 1, 3); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(1).SetCellValue("管道编号/单线号"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 4, 5); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("焊口编号"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 6, 7); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("焊工代号"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 8, 8); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue("规格 mm"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 9, 10); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue("材质"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 11, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(11).SetCellValue("焊接位置"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 12, 12); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(12).SetCellValue("焊接方法"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 13, 14); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(13).SetCellValue("焊材牌号"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 15, 16); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(15).SetCellValue("实际预热温度℃"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 17, 18); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(17).SetCellValue("焊缝外观检查"); + // ws.GetRow(rowIndex + 4).GetCell(17).SetCellValue("□合格"); + // ws.GetRow(rowIndex + 4).GetCell(18).SetCellValue("□不合格"); + // region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 19, 20); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 3).GetCell(19).SetCellValue("备注"); + // #endregion + // } + // #endregion + + // #region 数据 + // //创建数据行和列 + // ws = ExcelCreateRow(ws, hssfworkbook, tStart, tEnd, style, 0, 20); + // //获取当前页数据 + // var pageTb = GetPageToTable(tb, dStart, dEnd); + // //数据 + // for (int j = 0; j < pageTb.Rows.Count; j++) + // { + // var number = dStart == 0 ? j + 1 : dStart + 1 + j; + // int dataIndex = tStart + j; + // ws.GetRow(dataIndex).GetCell(0).SetCellValue(number); + // ws.GetRow(dataIndex).GetCell(1).SetCellValue(pageTb.Rows[j]["ISO_IsoNo"].ToString()); + // ws.GetRow(dataIndex).GetCell(4).SetCellValue(pageTb.Rows[j]["JOT_JointNo"].ToString()); + // ws.GetRow(dataIndex).GetCell(6).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString()); + // ws.GetRow(dataIndex).GetCell(8).SetCellValue(pageTb.Rows[j]["JOT_JointDesc"].ToString()); + // ws.GetRow(dataIndex).GetCell(9).SetCellValue(pageTb.Rows[j]["STE_Code"].ToString()); + // ws.GetRow(dataIndex).GetCell(11).SetCellValue(pageTb.Rows[j]["JOT_Location"].ToString()); + // ws.GetRow(dataIndex).GetCell(12).SetCellValue(pageTb.Rows[j]["WME_Name"].ToString()); + // ws.GetRow(dataIndex).GetCell(13).SetCellValue(pageTb.Rows[j]["WMT_MatName"].ToString()); + // ws.GetRow(dataIndex).GetCell(15).SetCellValue(pageTb.Rows[j]["JOT_PrepareTemp"].ToString()); + // ws.GetRow(dataIndex).GetCell(17).SetCellValue(pageTb.Rows[j]["PassVI"].ToString()); + // ws.GetRow(dataIndex).GetCell(18).SetCellValue(pageTb.Rows[j]["NoPassVI"].ToString()); + // ws.GetRow(dataIndex).GetCell(19).SetCellValue(pageTb.Rows[j]["Remark"].ToString()); + // } + // #endregion + + // #region 尾部 + // var tailIndex = tEnd + 1; + // //创建尾部行 + // ws.CreateRow(tailIndex); + // ws.CreateRow(tailIndex).HeightInPoints = 23f; + // ws.CreateRow(tailIndex + 1); + // ws.CreateRow(tailIndex + 1).HeightInPoints = 23f; + // for (int eIndex = 0; eIndex <= 20; eIndex++) + // { + // //行1 + // ws.GetRow(tailIndex).CreateCell(eIndex); + // ws.GetRow(tailIndex).GetCell(eIndex).CellStyle = styleFontLeft; + // //行2 + // ws.GetRow(tailIndex + 1).CreateCell(eIndex); + // ws.GetRow(tailIndex + 1).GetCell(eIndex).CellStyle = styleFontLeft; + // } + // //尾部行1 + // region = new CellRangeAddress(tailIndex, tailIndex, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(tailIndex).GetCell(0).SetCellValue("施工班组长:"); + // ws.GetRow(tailIndex).GetCell(0).CellStyle = styleFontLeft; + // region = new CellRangeAddress(tailIndex, tailIndex, 3, 10); + // ws.AddMergedRegion(region); + // ws.GetRow(tailIndex).GetCell(3).SetCellValue(""); + // ws.GetRow(tailIndex).GetCell(3).CellStyle = styleFontLeft; + // region = new CellRangeAddress(tailIndex, tailIndex, 11, 12); + // ws.AddMergedRegion(region); + // ws.GetRow(tailIndex).GetCell(11).SetCellValue("质量检查员:"); + // ws.GetRow(tailIndex).GetCell(11).CellStyle = styleFontLeft; + // region = new CellRangeAddress(tailIndex, tailIndex, 13, 20); + // ws.AddMergedRegion(region); + // ws.GetRow(tailIndex).GetCell(13).SetCellValue(""); + // ws.GetRow(tailIndex).GetCell(13).CellStyle = styleFontLeft; + + // //尾部行2 + // region = new CellRangeAddress(tailIndex + 1, tailIndex + 1, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(tailIndex + 1).GetCell(0).SetCellValue("日期:"); + // ws.GetRow(tailIndex + 1).GetCell(0).CellStyle = styleFontLeft; + // region = new CellRangeAddress(tailIndex + 1, tailIndex + 1, 3, 10); + // ws.AddMergedRegion(region); + // ws.GetRow(tailIndex + 1).GetCell(3).SetCellValue(""); + // ws.GetRow(tailIndex + 1).GetCell(3).CellStyle = styleFontLeft; + // region = new CellRangeAddress(tailIndex + 1, tailIndex + 1, 11, 12); + // ws.AddMergedRegion(region); + // ws.GetRow(tailIndex + 1).GetCell(11).SetCellValue("日期:"); + // ws.GetRow(tailIndex + 1).GetCell(11).CellStyle = styleFontLeft; + // region = new CellRangeAddress(tailIndex + 1, tailIndex + 1, 13, 20); + // ws.AddMergedRegion(region); + // ws.GetRow(tailIndex + 1).GetCell(13).SetCellValue(""); + // ws.GetRow(tailIndex + 1).GetCell(13).CellStyle = styleFontLeft; + // #endregion + + // rowIndex = tEnd + endaddNum; + // } + // } + // } + // } + + // ws.SetMargin(MarginType.LeftMargin, 0.1); + // ws.SetMargin(MarginType.RightMargin, 0); + + // //ws.SetMargin(MarginType.BottomMargin, 1.2); + // //ws.SetMargin(MarginType.TopMargin, 1.2); + + // ws.PrintSetup.Landscape = true; + // ws.PrintSetup.PaperSize = 9; + + // ws.ForceFormulaRecalculation = true; + // using (FileStream filess = File.OpenWrite(ReportFileName)) + // { + // hssfworkbook.Write(filess); + // } + // FileInfo filet = new FileInfo(ReportFileName); + // Response.Clear(); + // Response.Charset = "GB2312"; + // Response.ContentEncoding = System.Text.Encoding.UTF8; + // // 添加头信息,为"文件下载/另存为"对话框指定默认文件名 + // Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode("管道焊接接头报检检查记录.xlsx")); + // // 添加头信息,指定文件大小,让浏览器能够显示下载进度 + // Response.AddHeader("Content-Length", filet.Length.ToString()); + // // 指定返回的是一个不能被客户端读取的流,必须被下载 + // Response.ContentType = "application/ms-excel"; + // // 把文件流发送到客户端 + // Response.WriteFile(filet.FullName); + // // 停止页面的执行 + // Response.End(); + //} + #endregion } #endregion @@ -609,86 +704,86 @@ namespace FineUIPro.Web.ContinuousPrint /// 行和列 /// /// - private XSSFSheet ExcelCreateRowTitle(XSSFSheet ws, XSSFWorkbook hssfworkbook, int sRows, int eRows, ICellStyle style, int cStart, int cEnd) - { - for (int i = sRows; i <= eRows; i++) - { - ws.CreateRow(i); - ws.GetRow(i).HeightInPoints = i == sRows ? 30 : i == (sRows + 1) ? 27 : i == (sRows + 2) ? 28 : 23; - for (int j = cStart; j <= cEnd; j++) - { - ws.GetRow(i).CreateCell(j); - ws.GetRow(i).GetCell(j).CellStyle = style; - } - } - return ws; - } + //private XSSFSheet ExcelCreateRowTitle(XSSFSheet ws, XSSFWorkbook hssfworkbook, int sRows, int eRows, ICellStyle style, int cStart, int cEnd) + //{ + // for (int i = sRows; i <= eRows; i++) + // { + // ws.CreateRow(i); + // ws.GetRow(i).HeightInPoints = i == sRows ? 30 : i == (sRows + 1) ? 27 : i == (sRows + 2) ? 28 : 23; + // for (int j = cStart; j <= cEnd; j++) + // { + // ws.GetRow(i).CreateCell(j); + // ws.GetRow(i).GetCell(j).CellStyle = style; + // } + // } + // return ws; + //} /// /// 数据行 /// /// - private XSSFSheet ExcelCreateRow(XSSFSheet ws, XSSFWorkbook hssfworkbook, int sRows, int eRows, ICellStyle style, int cStart, int cEnd) - { - CellRangeAddress region; - for (int i = sRows; i <= eRows; i++) - { - ws.CreateRow(i); - ws.GetRow(i).HeightInPoints = 23f; - for (int j = cStart; j <= cEnd; j++) - { - ws.GetRow(i).CreateCell(j); - ws.GetRow(i).GetCell(j).CellStyle = style; - } - region = new CellRangeAddress(i, i, 1, 3); - ws.AddMergedRegion(region); - region = new CellRangeAddress(i, i, 4, 5); - ws.AddMergedRegion(region); - region = new CellRangeAddress(i, i, 6, 7); - ws.AddMergedRegion(region); - region = new CellRangeAddress(i, i, 9, 10); - ws.AddMergedRegion(region); - region = new CellRangeAddress(i, i, 13, 14); - ws.AddMergedRegion(region); - region = new CellRangeAddress(i, i, 15, 16); - ws.AddMergedRegion(region); - region = new CellRangeAddress(i, i, 19, 20); - ws.AddMergedRegion(region); - } - return ws; - } + //private XSSFSheet ExcelCreateRow(XSSFSheet ws, XSSFWorkbook hssfworkbook, int sRows, int eRows, ICellStyle style, int cStart, int cEnd) + //{ + // CellRangeAddress region; + // for (int i = sRows; i <= eRows; i++) + // { + // ws.CreateRow(i); + // ws.GetRow(i).HeightInPoints = 23f; + // for (int j = cStart; j <= cEnd; j++) + // { + // ws.GetRow(i).CreateCell(j); + // ws.GetRow(i).GetCell(j).CellStyle = style; + // } + // region = new CellRangeAddress(i, i, 1, 3); + // ws.AddMergedRegion(region); + // region = new CellRangeAddress(i, i, 4, 5); + // ws.AddMergedRegion(region); + // region = new CellRangeAddress(i, i, 6, 7); + // ws.AddMergedRegion(region); + // region = new CellRangeAddress(i, i, 9, 10); + // ws.AddMergedRegion(region); + // region = new CellRangeAddress(i, i, 13, 14); + // ws.AddMergedRegion(region); + // region = new CellRangeAddress(i, i, 15, 16); + // ws.AddMergedRegion(region); + // region = new CellRangeAddress(i, i, 19, 20); + // ws.AddMergedRegion(region); + // } + // return ws; + //} /// /// 查询指定条数分页 /// /// - public static DataTable GetPageToTable(DataTable dt, int StartNum, int EndNum) - { - //0页代表每页数据,直接返回 - if (EndNum == 0) return dt; - //数据源为空返回空DataTable - if (dt == null) return new DataTable(); + //public static DataTable GetPageToTable(DataTable dt, int StartNum, int EndNum) + //{ + // //0页代表每页数据,直接返回 + // if (EndNum == 0) return dt; + // //数据源为空返回空DataTable + // if (dt == null) return new DataTable(); - DataTable newdt = dt.Copy(); - newdt.Clear();//copy dt的框架 + // DataTable newdt = dt.Copy(); + // newdt.Clear();//copy dt的框架 - if (StartNum >= dt.Rows.Count) - return newdt;//源数据记录数小于等于要显示的记录,直接返回dt + // if (StartNum >= dt.Rows.Count) + // return newdt;//源数据记录数小于等于要显示的记录,直接返回dt - if (EndNum > dt.Rows.Count) - EndNum = dt.Rows.Count; - for (int i = StartNum; i <= EndNum - 1; i++) - { - DataRow newdr = newdt.NewRow(); - DataRow dr = dt.Rows[i]; - foreach (DataColumn column in dt.Columns) - { - newdr[column.ColumnName] = dr[column.ColumnName]; - } - newdt.Rows.Add(newdr); - } - return newdt; - } + // if (EndNum > dt.Rows.Count) + // EndNum = dt.Rows.Count; + // for (int i = StartNum; i <= EndNum - 1; i++) + // { + // DataRow newdr = newdt.NewRow(); + // DataRow dr = dt.Rows[i]; + // foreach (DataColumn column in dt.Columns) + // { + // newdr[column.ColumnName] = dr[column.ColumnName]; + // } + // newdt.Rows.Add(newdr); + // } + // return newdt; + //} #endregion } diff --git a/HJGL_DS/FineUIPro.Web/ContinuousPrint/WeldingRecordPrint.aspx b/HJGL_DS/FineUIPro.Web/ContinuousPrint/WeldingRecordPrint.aspx index 60a6816..3cf8627 100644 --- a/HJGL_DS/FineUIPro.Web/ContinuousPrint/WeldingRecordPrint.aspx +++ b/HJGL_DS/FineUIPro.Web/ContinuousPrint/WeldingRecordPrint.aspx @@ -110,7 +110,7 @@ - diff --git a/HJGL_DS/FineUIPro.Web/ContinuousPrint/WeldingRecordPrint.aspx.cs b/HJGL_DS/FineUIPro.Web/ContinuousPrint/WeldingRecordPrint.aspx.cs index f19864c..2ed0ef5 100644 --- a/HJGL_DS/FineUIPro.Web/ContinuousPrint/WeldingRecordPrint.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/ContinuousPrint/WeldingRecordPrint.aspx.cs @@ -157,36 +157,17 @@ namespace FineUIPro.Web.ContinuousPrint Alert.ShowInTop("最少选中一行!", MessageBoxIcon.Warning); return; } - string rootPath = Server.MapPath("~/") + Const.ExcelUrl; - //导出文件 - string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\"; - if (!Directory.Exists(filePath)) - { - Directory.CreateDirectory(filePath); - } - string ReportFileName = filePath + "out.xlsx"; + + string initTemplatePath = ""; + string rootPath = Server.MapPath("~/"); + BLL.Common.FastReportService.ResetData(); + + Dictionary keyValuePairs = new Dictionary(); + keyValuePairs.Add("ProjectName", hidProjectName.Value); + BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs); + if (Grid2.Rows.Count > 0) { - int rowIndex = 0; - XSSFWorkbook hssfworkbook = new XSSFWorkbook(); - XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("焊接工作记录"); - - #region 列宽 - ws.SetColumnWidth(0, (9 * 256) - 95);//(8.08)8.08 - ws.SetColumnWidth(1, (9 * 256) - 95);//(8.08)8.08 - ws.SetColumnWidth(2, (7 * 256) - 95);//(6.08)6.08 - ws.SetColumnWidth(3, (11 * 256) - 95);//(10.08)10.08 - ws.SetColumnWidth(4, (15 * 256) - 15);//(14.33)14.25 - ws.SetColumnWidth(5, (21 * 256) + 15);//(20.55)20.5 - ws.SetColumnWidth(6, (9 * 256) - 95);//(8.08)8.08 - ws.SetColumnWidth(7, (9 * 256) - 95);//(8.08)8.08 - ws.SetColumnWidth(8, (9 * 256) - 95);//(8.08)8.08 - ws.SetColumnWidth(9, (9 * 256) - 95);//(8.08)8.08 - ws.SetColumnWidth(10, (9 * 256) - 95);//(8.08)8.08 - ws.SetColumnWidth(11, (5 * 256) + 100);//(4.83)4.83 - ws.SetColumnWidth(12, (13 * 256) + 200);//(12.17)12.17 - #endregion - for (int gi = 0; gi < Grid2.Rows.Count; gi++) { if (Grid2.SelectedRowIndexArray.Contains(gi)) @@ -198,339 +179,429 @@ namespace FineUIPro.Web.ContinuousPrint listStr.Add(new SqlParameter("@Flag", "0")); SqlParameter[] parameter = listStr.ToArray(); var tb = SQLHelper.GetDataTableRunProc("HJGL_spJointWorkRecordNew", parameter); + if (tb.Rows.Count > 0) { - //tb.Columns.Add("index", typeof(System.Int32)); - //foreach (DataRow row in tb.Rows) - //{ - // try - // { - // row["index"] = int.Parse(System.Text.RegularExpressions.Regex.Replace(row["JOT_JointNo"].ToString(), @"[^0-9]+", "")); - // } - // catch (Exception ex) - // { - // row["index"] = 0; - // } - //} - //DataView dv = tb.DefaultView;//获取表视图 - //dv.Sort = "index ASC";//按照ID倒序排序 - //tb = dv.ToTable();//转为表 + DataTable dt = new DataTable(); + dt.TableName = "Data"; + dt.Columns.Add("ISO_IsoNo"); + dt.Columns.Add("JOT_JointNo"); + dt.Columns.Add("WED_Code"); + dt.Columns.Add("JOT_JointDesc"); + dt.Columns.Add("STE_Code"); + dt.Columns.Add("weldLocal"); + dt.Columns.Add("WME_Name"); + dt.Columns.Add("WMT_MatName"); + dt.Columns.Add("JOT_PrepareTemp"); + dt.Columns.Add("WeldDate"); + tb.DefaultView.Sort = "JOTY_Group,Sort1,Sort2,Sort3,Sort4,Sort5 ASC"; - CellRangeAddress region; - //尾页面总数 - var pageNum = 0d; - //尾部增加行 - var endaddNum = 0; - //公共样式 - ICellStyle style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true); - //文字靠左左侧无边框 - ICellStyle styleFontLeft = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true); - //文字靠左右边无边框 - ICellStyle styleRightNoneFontLeft = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true); - //头部样式 - ICellStyle styleTou = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 16, true, true); - //计算页 - pageNum = - tb.Rows.Count <= 11 ? 1 - : (tb.Rows.Count > 11 && tb.Rows.Count <= 27) ? 2 - : Math.Ceiling((float)(tb.Rows.Count - 27) / 16) + 2; - //循环页 - for (int i = 1; i <= pageNum; i++) + DataRow[] rows = tb.DefaultView.ToTable().Select(); + foreach (var row in rows) { - //取数据开始和结束条数 - var dStart = 0; - var dEnd = 0; - //excel数据开始行和结束行 - var tStart = 0; - var tEnd = 0; - - #region 头部和每页数据参数 - //第一页和第二页需要创建头 - if (i == 1) - { - //尾部增加行 - endaddNum = 8; - //创建头部行和列 - ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 2, style, 0, 12); - //取数据开始和结束条数 - dStart = 0; - dEnd = 11; - //excel数据开始行和结束行 - tStart = rowIndex + 3; - tEnd = rowIndex + 13; - - #region 头部 - //行1 - region = new CellRangeAddress(rowIndex, rowIndex + 1, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3503-J415-1"); - region = new CellRangeAddress(rowIndex, rowIndex + 1, 3, 8); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(3).SetCellValue("管道焊接工作记录"); - ws.GetRow(rowIndex).GetCell(3).CellStyle = styleTou; - region = new CellRangeAddress(rowIndex, rowIndex, 9, 10); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(9).SetCellValue("工程名称:"); - region = new CellRangeAddress(rowIndex, rowIndex, 11, 12); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(10).CellStyle = styleRightNoneFontLeft; - ws.GetRow(rowIndex).GetCell(11).SetCellValue(hidProjectName.Value); - ws.GetRow(rowIndex).GetCell(11).CellStyle = styleFontLeft; - //行2 - region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 9, 10); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 1).GetCell(9).SetCellValue("单位工程名称:"); - region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 11, 12); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 1).GetCell(10).CellStyle = styleRightNoneFontLeft; - ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue("管道安装工程"); - ws.GetRow(rowIndex + 1).GetCell(11).CellStyle = styleFontLeft; - //行3 - ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("管道编号/单线号"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue("焊口\n编号"); - ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue("焊工\n代号"); - ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue("规格\nmm"); - ws.GetRow(rowIndex + 2).GetCell(5).SetCellValue("材质"); - ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("焊接位置"); - ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("焊接方法"); - ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("焊材牌号"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 9); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue("实际预热\n温度℃"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 10, 11); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(12).SetCellValue("焊接日期"); - #endregion - - } - else - { - //尾部增加行 - endaddNum = 2; - //创建头部行和列 - ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 3, style, 0, 12); - var pNum = (i - 1) * 16; - //取数据开始和结束条数 - dStart = 11 + ((i - 2) * 16); - dEnd = 11 + pNum; - //excel数据开始行和结束行 - tStart = rowIndex + 3; - tEnd = rowIndex + 18; - - #region 头部(续) - //行1 - region = new CellRangeAddress(rowIndex, rowIndex + 1, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3503-J415-2"); - region = new CellRangeAddress(rowIndex, rowIndex + 1, 3, 8); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(3).SetCellValue("管道焊接工作记录(续)"); - ws.GetRow(rowIndex).GetCell(3).CellStyle = styleTou; - region = new CellRangeAddress(rowIndex, rowIndex, 9, 10); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(9).SetCellValue("工程名称:"); - region = new CellRangeAddress(rowIndex, rowIndex, 11, 12); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(10).CellStyle = styleRightNoneFontLeft; - ws.GetRow(rowIndex).GetCell(11).SetCellValue(hidProjectName.Value); - ws.GetRow(rowIndex).GetCell(11).CellStyle = styleFontLeft; - //行2 - region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 9, 10); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 1).GetCell(9).SetCellValue("单位工程名称:"); - region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 11, 12); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 1).GetCell(10).CellStyle = styleRightNoneFontLeft; - ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue("管道安装工程"); - ws.GetRow(rowIndex + 1).GetCell(11).CellStyle = styleFontLeft; - //行3 - ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("管道编号/单线号"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue("焊口\n编号"); - ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue("焊工\n代号"); - ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue("规格\nmm"); - ws.GetRow(rowIndex + 2).GetCell(5).SetCellValue("材质"); - ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("焊接位置"); - ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("焊接方法"); - ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("焊材牌号"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 9); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue("实际预热\n温度℃"); - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 10, 11); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(12).SetCellValue("焊接日期"); - - #endregion - } - #endregion - - #region 数据 - //创建数据行和列 - ws = ExcelCreateRow(ws, hssfworkbook, tStart, tEnd, style, 0, 12); - //获取当前页数据 - var pageTb = GetPageToTable(tb, dStart, dEnd); - //遍历数据 - for (int j = 0; j < pageTb.Rows.Count; j++) - { - int dataRow = tStart + j; - ws.GetRow(dataRow).GetCell(0).SetCellValue(pageTb.Rows[j]["ISO_IsoNo"].ToString()); - ws.GetRow(dataRow).GetCell(2).SetCellValue(pageTb.Rows[j]["JOT_JointNo"].ToString()); - ws.GetRow(dataRow).GetCell(3).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString()); - ws.GetRow(dataRow).GetCell(4).SetCellValue(pageTb.Rows[j]["JOT_JointDesc"].ToString()); - ws.GetRow(dataRow).GetCell(5).SetCellValue(pageTb.Rows[j]["STE_Code"].ToString()); - ws.GetRow(dataRow).GetCell(6).SetCellValue(pageTb.Rows[j]["weldLocal"].ToString()); - ws.GetRow(dataRow).GetCell(7).SetCellValue(pageTb.Rows[j]["WME_Name"].ToString()); - ws.GetRow(dataRow).GetCell(8).SetCellValue(pageTb.Rows[j]["WMT_MatName"].ToString()); - ws.GetRow(dataRow).GetCell(10).SetCellValue(pageTb.Rows[j]["JOT_PrepareTemp"].ToString()); - ws.GetRow(dataRow).GetCell(12).SetCellValue(pageTb.Rows[j]["WeldDate"].ToString()); - } - #endregion - - #region 尾部 - if (i == 1) - { - //尾部样式无线条 - ICellStyle noneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10); - int ej = 0; - //创建尾部 - ws.CreateRow(tEnd + 1); - ws.CreateRow(tEnd + 1).HeightInPoints = 21f; - ws.CreateRow(tEnd + 2); - ws.CreateRow(tEnd + 2).HeightInPoints = 21f; - ws.CreateRow(tEnd + 3); - ws.CreateRow(tEnd + 3).HeightInPoints = 21f; - ws.CreateRow(tEnd + 4); - ws.CreateRow(tEnd + 4).HeightInPoints = 21f; - ws.CreateRow(tEnd + 5); - ws.CreateRow(tEnd + 5).HeightInPoints = 21f; - for (int eIndex = 0; eIndex <= 12; eIndex++) - { - //行1 - ws.GetRow(tEnd + 1).CreateCell(eIndex); - ws.GetRow(tEnd + 1).GetCell(eIndex).CellStyle = style; - //行2 - ws.GetRow(tEnd + 2).CreateCell(eIndex); - ws.GetRow(tEnd + 2).GetCell(eIndex).CellStyle = noneStyle; - //行3 - ws.GetRow(tEnd + 3).CreateCell(eIndex); - ws.GetRow(tEnd + 3).GetCell(eIndex).CellStyle = noneStyle; - //行4 - ws.GetRow(tEnd + 4).CreateCell(eIndex); - ws.GetRow(tEnd + 4).GetCell(eIndex).CellStyle = noneStyle; - //行5 - ws.GetRow(tEnd + 5).CreateCell(eIndex); ej++; - } - //尾部样式左侧线文字靠右 - ICellStyle leftStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10); - //尾部样式左侧线文字居中 - ICellStyle createStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10); - //尾部样式右侧线条文字靠右 - ICellStyle rightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10); - //尾部样式左下线文字靠右 - ICellStyle leftBottStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10); - //尾部样式右下线条文字靠右 - ICellStyle rightBottStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10); - - //尾部行1 - region = new CellRangeAddress(tEnd + 1, tEnd + 1, 0, 3); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 1).GetCell(0).SetCellValue("建设/监理单位"); - region = new CellRangeAddress(tEnd + 1, tEnd + 1, 4, 7); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 1).GetCell(4).SetCellValue("总承包单位"); - region = new CellRangeAddress(tEnd + 1, tEnd + 1, 8, 12); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 1).GetCell(8).SetCellValue("施工单位"); - //尾部行2 - ws.GetRow(tEnd + 2).GetCell(0).SetCellValue("专业工程师:"); - ws.GetRow(tEnd + 2).GetCell(0).CellStyle = createStyle; - region = new CellRangeAddress(tEnd + 2, tEnd + 2, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 2).GetCell(4).SetCellValue("专业工程师:"); - ws.GetRow(tEnd + 2).GetCell(4).CellStyle = leftStyle; - region = new CellRangeAddress(tEnd + 2, tEnd + 2, 8, 9); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 2).GetCell(8).SetCellValue("记录人:"); - ws.GetRow(tEnd + 2).GetCell(8).CellStyle = leftStyle; - ws.GetRow(tEnd + 2).GetCell(12).CellStyle = rightStyle; - //尾部行3 - ws.GetRow(tEnd + 3).GetCell(0).CellStyle = leftStyle; - ws.GetRow(tEnd + 3).GetCell(4).CellStyle = leftStyle; - region = new CellRangeAddress(tEnd + 3, tEnd + 3, 8, 9); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 3).GetCell(8).SetCellValue("质量检查员:"); - ws.GetRow(tEnd + 3).GetCell(8).CellStyle = leftStyle; - ws.GetRow(tEnd + 3).GetCell(12).CellStyle = rightStyle; - //尾部行4 - ws.GetRow(tEnd + 4).GetCell(0).CellStyle = leftStyle; - ws.GetRow(tEnd + 4).GetCell(4).CellStyle = leftStyle; - region = new CellRangeAddress(tEnd + 4, tEnd + 4, 8, 9); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 4).GetCell(8).SetCellValue("焊接责任工程师:"); - ws.GetRow(tEnd + 4).GetCell(8).CellStyle = leftStyle; - ws.GetRow(tEnd + 4).GetCell(12).CellStyle = rightStyle; - //尾部行5 - ws.GetRow(tEnd + 5).GetCell(0).SetCellValue("日期:"); - ws.GetRow(tEnd + 5).GetCell(0).CellStyle = leftBottStyle; - region = new CellRangeAddress(tEnd + 5, tEnd + 5, 1, 3); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 5).GetCell(1).SetCellValue("年 月 日"); - ws.GetRow(tEnd + 5).GetCell(1).CellStyle = ws.GetRow(tEnd + 5).GetCell(2).CellStyle = ws.GetRow(tEnd + 5).GetCell(3).CellStyle = rightBottStyle; - - ws.GetRow(tEnd + 5).GetCell(4).SetCellValue("日期:"); - ws.GetRow(tEnd + 5).GetCell(4).CellStyle = leftBottStyle; - region = new CellRangeAddress(tEnd + 5, tEnd + 5, 5, 7); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 5).GetCell(5).SetCellValue(" 年 月 日"); - ws.GetRow(tEnd + 5).GetCell(5).CellStyle = ws.GetRow(tEnd + 5).GetCell(6).CellStyle = ws.GetRow(tEnd + 5).GetCell(7).CellStyle = rightBottStyle; - - region = new CellRangeAddress(tEnd + 5, tEnd + 5, 8, 9); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 5).GetCell(8).SetCellValue("日期:"); - ws.GetRow(tEnd + 5).GetCell(8).CellStyle = ws.GetRow(tEnd + 5).GetCell(9).CellStyle = leftBottStyle; - region = new CellRangeAddress(tEnd + 5, tEnd + 5, 10, 12); - ws.AddMergedRegion(region); - ws.GetRow(tEnd + 5).GetCell(10).SetCellValue("年 月 日"); - ws.GetRow(tEnd + 5).GetCell(10).CellStyle = ws.GetRow(tEnd + 5).GetCell(11).CellStyle = ws.GetRow(tEnd + 5).GetCell(12).CellStyle = rightBottStyle; - } - #endregion - - rowIndex = tEnd + endaddNum; + var newRow = dt.NewRow(); + newRow["ISO_IsoNo"] = row["ISO_IsoNo"].ToString(); + newRow["JOT_JointNo"] = row["JOT_JointNo"].ToString(); + newRow["WED_Code"] = row["WED_Code"].ToString(); + newRow["JOT_JointDesc"] = row["JOT_JointDesc"].ToString(); + newRow["STE_Code"] = row["STE_Code"].ToString(); + newRow["weldLocal"] = row["weldLocal"].ToString(); + newRow["WME_Name"] = row["WME_Name"].ToString(); + newRow["WMT_MatName"] = row["WMT_MatName"].ToString(); + newRow["JOT_PrepareTemp"] = row["JOT_PrepareTemp"].ToString(); + newRow["WeldDate"] = string.Format("{0:yyyy-MM-dd}", row["WeldDate"]); + dt.Rows.Add(newRow); } + BLL.Common.FastReportService.AddFastreportTable(dt); + + initTemplatePath = "File\\Fastreport\\管道焊接工作记录.frx"; + } } } - - ws.SetMargin(MarginType.LeftMargin, 0.6); - ws.SetMargin(MarginType.RightMargin, 0.2); - //ws.SetMargin(MarginType.BottomMargin, 1); - //ws.SetMargin(MarginType.TopMargin, 1); - ws.PrintSetup.Landscape = true; - ws.PrintSetup.PaperSize = 9; - - ws.ForceFormulaRecalculation = true; - using (FileStream filess = File.OpenWrite(ReportFileName)) + if (File.Exists(rootPath + initTemplatePath)) { - hssfworkbook.Write(filess); + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../common/ReportPrint/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); + } - FileInfo filet = new FileInfo(ReportFileName); - Response.Clear(); - Response.Charset = "GB2312"; - Response.ContentEncoding = System.Text.Encoding.UTF8; - // 添加头信息,为"文件下载/另存为"对话框指定默认文件名 - Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode("管道焊接记录.xlsx")); - // 添加头信息,指定文件大小,让浏览器能够显示下载进度 - Response.AddHeader("Content-Length", filet.Length.ToString()); - // 指定返回的是一个不能被客户端读取的流,必须被下载 - Response.ContentType = "application/ms-excel"; - // 把文件流发送到客户端 - Response.WriteFile(filet.FullName); - // 停止页面的执行 - Response.End(); } + + #region 导出Excel,不用了 + //string rootPath = Server.MapPath("~/") + Const.ExcelUrl; + ////导出文件 + //string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\"; + //if (!Directory.Exists(filePath)) + //{ + // Directory.CreateDirectory(filePath); + //} + //string ReportFileName = filePath + "out.xlsx"; + //if (Grid2.Rows.Count > 0) + //{ + // int rowIndex = 0; + // XSSFWorkbook hssfworkbook = new XSSFWorkbook(); + // XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("焊接工作记录"); + + // #region 列宽 + // ws.SetColumnWidth(0, (9 * 256) - 95);//(8.08)8.08 + // ws.SetColumnWidth(1, (9 * 256) - 95);//(8.08)8.08 + // ws.SetColumnWidth(2, (7 * 256) - 95);//(6.08)6.08 + // ws.SetColumnWidth(3, (11 * 256) - 95);//(10.08)10.08 + // ws.SetColumnWidth(4, (15 * 256) - 15);//(14.33)14.25 + // ws.SetColumnWidth(5, (21 * 256) + 15);//(20.55)20.5 + // ws.SetColumnWidth(6, (9 * 256) - 95);//(8.08)8.08 + // ws.SetColumnWidth(7, (9 * 256) - 95);//(8.08)8.08 + // ws.SetColumnWidth(8, (9 * 256) - 95);//(8.08)8.08 + // ws.SetColumnWidth(9, (9 * 256) - 95);//(8.08)8.08 + // ws.SetColumnWidth(10, (9 * 256) - 95);//(8.08)8.08 + // ws.SetColumnWidth(11, (5 * 256) + 100);//(4.83)4.83 + // ws.SetColumnWidth(12, (13 * 256) + 200);//(12.17)12.17 + // #endregion + + // for (int gi = 0; gi < Grid2.Rows.Count; gi++) + // { + // if (Grid2.SelectedRowIndexArray.Contains(gi)) + // { + // System.Web.UI.WebControls.HiddenField hidISO_ID = Grid2.Rows[gi].FindControl("hidISO_ID") as System.Web.UI.WebControls.HiddenField; + // System.Web.UI.WebControls.HiddenField hidProjectName = Grid2.Rows[gi].FindControl("hidProjectName") as System.Web.UI.WebControls.HiddenField; + // var listStr = new List(); + // listStr.Add(new SqlParameter("@IsoId", hidISO_ID.Value)); + // listStr.Add(new SqlParameter("@Flag", "0")); + // SqlParameter[] parameter = listStr.ToArray(); + // var tb = SQLHelper.GetDataTableRunProc("HJGL_spJointWorkRecordNew", parameter); + // if (tb.Rows.Count > 0) + // { + // //tb.Columns.Add("index", typeof(System.Int32)); + // //foreach (DataRow row in tb.Rows) + // //{ + // // try + // // { + // // row["index"] = int.Parse(System.Text.RegularExpressions.Regex.Replace(row["JOT_JointNo"].ToString(), @"[^0-9]+", "")); + // // } + // // catch (Exception ex) + // // { + // // row["index"] = 0; + // // } + // //} + // //DataView dv = tb.DefaultView;//获取表视图 + // //dv.Sort = "index ASC";//按照ID倒序排序 + // //tb = dv.ToTable();//转为表 + + // CellRangeAddress region; + // //尾页面总数 + // var pageNum = 0d; + // //尾部增加行 + // var endaddNum = 0; + // //公共样式 + // ICellStyle style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true); + // //文字靠左左侧无边框 + // ICellStyle styleFontLeft = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true); + // //文字靠左右边无边框 + // ICellStyle styleRightNoneFontLeft = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true); + // //头部样式 + // ICellStyle styleTou = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 16, true, true); + // //计算页 + // pageNum = + // tb.Rows.Count <= 11 ? 1 + // : (tb.Rows.Count > 11 && tb.Rows.Count <= 27) ? 2 + // : Math.Ceiling((float)(tb.Rows.Count - 27) / 16) + 2; + // //循环页 + // for (int i = 1; i <= pageNum; i++) + // { + // //取数据开始和结束条数 + // var dStart = 0; + // var dEnd = 0; + // //excel数据开始行和结束行 + // var tStart = 0; + // var tEnd = 0; + + // #region 头部和每页数据参数 + // //第一页和第二页需要创建头 + // if (i == 1) + // { + // //尾部增加行 + // endaddNum = 8; + // //创建头部行和列 + // ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 2, style, 0, 12); + // //取数据开始和结束条数 + // dStart = 0; + // dEnd = 11; + // //excel数据开始行和结束行 + // tStart = rowIndex + 3; + // tEnd = rowIndex + 13; + + // #region 头部 + // //行1 + // region = new CellRangeAddress(rowIndex, rowIndex + 1, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3503-J415-1"); + // region = new CellRangeAddress(rowIndex, rowIndex + 1, 3, 8); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(3).SetCellValue("管道焊接工作记录"); + // ws.GetRow(rowIndex).GetCell(3).CellStyle = styleTou; + // region = new CellRangeAddress(rowIndex, rowIndex, 9, 10); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(9).SetCellValue("工程名称:"); + // region = new CellRangeAddress(rowIndex, rowIndex, 11, 12); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(10).CellStyle = styleRightNoneFontLeft; + // ws.GetRow(rowIndex).GetCell(11).SetCellValue(hidProjectName.Value); + // ws.GetRow(rowIndex).GetCell(11).CellStyle = styleFontLeft; + // //行2 + // region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 9, 10); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 1).GetCell(9).SetCellValue("单位工程名称:"); + // region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 11, 12); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 1).GetCell(10).CellStyle = styleRightNoneFontLeft; + // ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue("管道安装工程"); + // ws.GetRow(rowIndex + 1).GetCell(11).CellStyle = styleFontLeft; + // //行3 + // ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("管道编号/单线号"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 1); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue("焊口\n编号"); + // ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue("焊工\n代号"); + // ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue("规格\nmm"); + // ws.GetRow(rowIndex + 2).GetCell(5).SetCellValue("材质"); + // ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("焊接位置"); + // ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("焊接方法"); + // ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("焊材牌号"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 9); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue("实际预热\n温度℃"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 10, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(12).SetCellValue("焊接日期"); + // #endregion + + // } + // else + // { + // //尾部增加行 + // endaddNum = 2; + // //创建头部行和列 + // ws = ExcelCreateRowTitle(ws, hssfworkbook, rowIndex, rowIndex + 3, style, 0, 12); + // var pNum = (i - 1) * 16; + // //取数据开始和结束条数 + // dStart = 11 + ((i - 2) * 16); + // dEnd = 11 + pNum; + // //excel数据开始行和结束行 + // tStart = rowIndex + 3; + // tEnd = rowIndex + 18; + + // #region 头部(续) + // //行1 + // region = new CellRangeAddress(rowIndex, rowIndex + 1, 0, 2); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3503-J415-2"); + // region = new CellRangeAddress(rowIndex, rowIndex + 1, 3, 8); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(3).SetCellValue("管道焊接工作记录(续)"); + // ws.GetRow(rowIndex).GetCell(3).CellStyle = styleTou; + // region = new CellRangeAddress(rowIndex, rowIndex, 9, 10); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(9).SetCellValue("工程名称:"); + // region = new CellRangeAddress(rowIndex, rowIndex, 11, 12); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex).GetCell(10).CellStyle = styleRightNoneFontLeft; + // ws.GetRow(rowIndex).GetCell(11).SetCellValue(hidProjectName.Value); + // ws.GetRow(rowIndex).GetCell(11).CellStyle = styleFontLeft; + // //行2 + // region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 9, 10); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 1).GetCell(9).SetCellValue("单位工程名称:"); + // region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 11, 12); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 1).GetCell(10).CellStyle = styleRightNoneFontLeft; + // ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue("管道安装工程"); + // ws.GetRow(rowIndex + 1).GetCell(11).CellStyle = styleFontLeft; + // //行3 + // ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("管道编号/单线号"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 1); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue("焊口\n编号"); + // ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue("焊工\n代号"); + // ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue("规格\nmm"); + // ws.GetRow(rowIndex + 2).GetCell(5).SetCellValue("材质"); + // ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("焊接位置"); + // ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("焊接方法"); + // ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("焊材牌号"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 9); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue("实际预热\n温度℃"); + // region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 10, 11); + // ws.AddMergedRegion(region); + // ws.GetRow(rowIndex + 2).GetCell(12).SetCellValue("焊接日期"); + + // #endregion + // } + // #endregion + + // #region 数据 + // //创建数据行和列 + // ws = ExcelCreateRow(ws, hssfworkbook, tStart, tEnd, style, 0, 12); + // //获取当前页数据 + // var pageTb = GetPageToTable(tb, dStart, dEnd); + // //遍历数据 + // for (int j = 0; j < pageTb.Rows.Count; j++) + // { + // int dataRow = tStart + j; + // ws.GetRow(dataRow).GetCell(0).SetCellValue(pageTb.Rows[j]["ISO_IsoNo"].ToString()); + // ws.GetRow(dataRow).GetCell(2).SetCellValue(pageTb.Rows[j]["JOT_JointNo"].ToString()); + // ws.GetRow(dataRow).GetCell(3).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString()); + // ws.GetRow(dataRow).GetCell(4).SetCellValue(pageTb.Rows[j]["JOT_JointDesc"].ToString()); + // ws.GetRow(dataRow).GetCell(5).SetCellValue(pageTb.Rows[j]["STE_Code"].ToString()); + // ws.GetRow(dataRow).GetCell(6).SetCellValue(pageTb.Rows[j]["weldLocal"].ToString()); + // ws.GetRow(dataRow).GetCell(7).SetCellValue(pageTb.Rows[j]["WME_Name"].ToString()); + // ws.GetRow(dataRow).GetCell(8).SetCellValue(pageTb.Rows[j]["WMT_MatName"].ToString()); + // ws.GetRow(dataRow).GetCell(10).SetCellValue(pageTb.Rows[j]["JOT_PrepareTemp"].ToString()); + // ws.GetRow(dataRow).GetCell(12).SetCellValue(pageTb.Rows[j]["WeldDate"].ToString()); + // } + // #endregion + + // #region 尾部 + // if (i == 1) + // { + // //尾部样式无线条 + // ICellStyle noneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10); + // int ej = 0; + // //创建尾部 + // ws.CreateRow(tEnd + 1); + // ws.CreateRow(tEnd + 1).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 2); + // ws.CreateRow(tEnd + 2).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 3); + // ws.CreateRow(tEnd + 3).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 4); + // ws.CreateRow(tEnd + 4).HeightInPoints = 21f; + // ws.CreateRow(tEnd + 5); + // ws.CreateRow(tEnd + 5).HeightInPoints = 21f; + // for (int eIndex = 0; eIndex <= 12; eIndex++) + // { + // //行1 + // ws.GetRow(tEnd + 1).CreateCell(eIndex); + // ws.GetRow(tEnd + 1).GetCell(eIndex).CellStyle = style; + // //行2 + // ws.GetRow(tEnd + 2).CreateCell(eIndex); + // ws.GetRow(tEnd + 2).GetCell(eIndex).CellStyle = noneStyle; + // //行3 + // ws.GetRow(tEnd + 3).CreateCell(eIndex); + // ws.GetRow(tEnd + 3).GetCell(eIndex).CellStyle = noneStyle; + // //行4 + // ws.GetRow(tEnd + 4).CreateCell(eIndex); + // ws.GetRow(tEnd + 4).GetCell(eIndex).CellStyle = noneStyle; + // //行5 + // ws.GetRow(tEnd + 5).CreateCell(eIndex); ej++; + // } + // //尾部样式左侧线文字靠右 + // ICellStyle leftStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10); + // //尾部样式左侧线文字居中 + // ICellStyle createStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10); + // //尾部样式右侧线条文字靠右 + // ICellStyle rightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10); + // //尾部样式左下线文字靠右 + // ICellStyle leftBottStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10); + // //尾部样式右下线条文字靠右 + // ICellStyle rightBottStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10); + + // //尾部行1 + // region = new CellRangeAddress(tEnd + 1, tEnd + 1, 0, 3); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 1).GetCell(0).SetCellValue("建设/监理单位"); + // region = new CellRangeAddress(tEnd + 1, tEnd + 1, 4, 7); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 1).GetCell(4).SetCellValue("总承包单位"); + // region = new CellRangeAddress(tEnd + 1, tEnd + 1, 8, 12); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 1).GetCell(8).SetCellValue("施工单位"); + // //尾部行2 + // ws.GetRow(tEnd + 2).GetCell(0).SetCellValue("专业工程师:"); + // ws.GetRow(tEnd + 2).GetCell(0).CellStyle = createStyle; + // region = new CellRangeAddress(tEnd + 2, tEnd + 2, 0, 1); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 2).GetCell(4).SetCellValue("专业工程师:"); + // ws.GetRow(tEnd + 2).GetCell(4).CellStyle = leftStyle; + // region = new CellRangeAddress(tEnd + 2, tEnd + 2, 8, 9); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 2).GetCell(8).SetCellValue("记录人:"); + // ws.GetRow(tEnd + 2).GetCell(8).CellStyle = leftStyle; + // ws.GetRow(tEnd + 2).GetCell(12).CellStyle = rightStyle; + // //尾部行3 + // ws.GetRow(tEnd + 3).GetCell(0).CellStyle = leftStyle; + // ws.GetRow(tEnd + 3).GetCell(4).CellStyle = leftStyle; + // region = new CellRangeAddress(tEnd + 3, tEnd + 3, 8, 9); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 3).GetCell(8).SetCellValue("质量检查员:"); + // ws.GetRow(tEnd + 3).GetCell(8).CellStyle = leftStyle; + // ws.GetRow(tEnd + 3).GetCell(12).CellStyle = rightStyle; + // //尾部行4 + // ws.GetRow(tEnd + 4).GetCell(0).CellStyle = leftStyle; + // ws.GetRow(tEnd + 4).GetCell(4).CellStyle = leftStyle; + // region = new CellRangeAddress(tEnd + 4, tEnd + 4, 8, 9); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 4).GetCell(8).SetCellValue("焊接责任工程师:"); + // ws.GetRow(tEnd + 4).GetCell(8).CellStyle = leftStyle; + // ws.GetRow(tEnd + 4).GetCell(12).CellStyle = rightStyle; + // //尾部行5 + // ws.GetRow(tEnd + 5).GetCell(0).SetCellValue("日期:"); + // ws.GetRow(tEnd + 5).GetCell(0).CellStyle = leftBottStyle; + // region = new CellRangeAddress(tEnd + 5, tEnd + 5, 1, 3); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 5).GetCell(1).SetCellValue("年 月 日"); + // ws.GetRow(tEnd + 5).GetCell(1).CellStyle = ws.GetRow(tEnd + 5).GetCell(2).CellStyle = ws.GetRow(tEnd + 5).GetCell(3).CellStyle = rightBottStyle; + + // ws.GetRow(tEnd + 5).GetCell(4).SetCellValue("日期:"); + // ws.GetRow(tEnd + 5).GetCell(4).CellStyle = leftBottStyle; + // region = new CellRangeAddress(tEnd + 5, tEnd + 5, 5, 7); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 5).GetCell(5).SetCellValue(" 年 月 日"); + // ws.GetRow(tEnd + 5).GetCell(5).CellStyle = ws.GetRow(tEnd + 5).GetCell(6).CellStyle = ws.GetRow(tEnd + 5).GetCell(7).CellStyle = rightBottStyle; + + // region = new CellRangeAddress(tEnd + 5, tEnd + 5, 8, 9); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 5).GetCell(8).SetCellValue("日期:"); + // ws.GetRow(tEnd + 5).GetCell(8).CellStyle = ws.GetRow(tEnd + 5).GetCell(9).CellStyle = leftBottStyle; + // region = new CellRangeAddress(tEnd + 5, tEnd + 5, 10, 12); + // ws.AddMergedRegion(region); + // ws.GetRow(tEnd + 5).GetCell(10).SetCellValue("年 月 日"); + // ws.GetRow(tEnd + 5).GetCell(10).CellStyle = ws.GetRow(tEnd + 5).GetCell(11).CellStyle = ws.GetRow(tEnd + 5).GetCell(12).CellStyle = rightBottStyle; + // } + // #endregion + + // rowIndex = tEnd + endaddNum; + // } + // } + // } + // } + + // ws.SetMargin(MarginType.LeftMargin, 0.6); + // ws.SetMargin(MarginType.RightMargin, 0.2); + // //ws.SetMargin(MarginType.BottomMargin, 1); + // //ws.SetMargin(MarginType.TopMargin, 1); + // ws.PrintSetup.Landscape = true; + // ws.PrintSetup.PaperSize = 9; + + // ws.ForceFormulaRecalculation = true; + // using (FileStream filess = File.OpenWrite(ReportFileName)) + // { + // hssfworkbook.Write(filess); + // } + // FileInfo filet = new FileInfo(ReportFileName); + // Response.Clear(); + // Response.Charset = "GB2312"; + // Response.ContentEncoding = System.Text.Encoding.UTF8; + // // 添加头信息,为"文件下载/另存为"对话框指定默认文件名 + // Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode("管道焊接记录.xlsx")); + // // 添加头信息,指定文件大小,让浏览器能够显示下载进度 + // Response.AddHeader("Content-Length", filet.Length.ToString()); + // // 指定返回的是一个不能被客户端读取的流,必须被下载 + // Response.ContentType = "application/ms-excel"; + // // 把文件流发送到客户端 + // Response.WriteFile(filet.FullName); + // // 停止页面的执行 + // Response.End(); + //} + #endregion } #endregion diff --git a/HJGL_DS/FineUIPro.Web/File/Fastreport/射线检测记录.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/射线检测记录.frx new file mode 100644 index 0000000..161de58 --- /dev/null +++ b/HJGL_DS/FineUIPro.Web/File/Fastreport/射线检测记录.frx @@ -0,0 +1,557 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HJGL_DS/FineUIPro.Web/File/Fastreport/管道对接焊接接头报检检查记录.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/管道对接焊接接头报检检查记录.frx index 174dddd..6a0ef4e 100644 --- a/HJGL_DS/FineUIPro.Web/File/Fastreport/管道对接焊接接头报检检查记录.frx +++ b/HJGL_DS/FineUIPro.Web/File/Fastreport/管道对接焊接接头报检检查记录.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -42,7 +42,7 @@ namespace FastReport } - + diff --git a/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊口检测委托单.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊口检测委托单.frx index b737e17..87f0545 100644 --- a/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊口检测委托单.frx +++ b/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊口检测委托单.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -42,7 +42,7 @@ namespace FastReport } - + diff --git a/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊接工作记录.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊接工作记录.frx index e120a26..2587244 100644 --- a/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊接工作记录.frx +++ b/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊接工作记录.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -50,7 +50,7 @@ namespace FastReport } - + diff --git a/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊接接头报检检查记录.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊接接头报检检查记录.frx index 0fe0379..840c70b 100644 --- a/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊接接头报检检查记录.frx +++ b/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊接接头报检检查记录.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -42,7 +42,7 @@ namespace FastReport } - + @@ -62,8 +62,9 @@ namespace FastReport + - + @@ -135,19 +136,19 @@ namespace FastReport - + - + - + - + @@ -164,7 +165,7 @@ namespace FastReport - + diff --git a/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊缝检测委托单.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊缝检测委托单.frx index 9076230..4168bc8 100644 --- a/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊缝检测委托单.frx +++ b/HJGL_DS/FineUIPro.Web/File/Fastreport/管道焊缝检测委托单.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -41,7 +41,7 @@ namespace FastReport } - + diff --git a/HJGL_DS/FineUIPro.Web/File/Fastreport/管道返修焊接工作记录.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/管道返修焊接工作记录.frx index d7ee644..c83dedf 100644 --- a/HJGL_DS/FineUIPro.Web/File/Fastreport/管道返修焊接工作记录.frx +++ b/HJGL_DS/FineUIPro.Web/File/Fastreport/管道返修焊接工作记录.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -63,7 +63,7 @@ namespace FastReport } - + diff --git a/HJGL_DS/FineUIPro.Web/File/Fastreport/项目管理部焊缝检测委托单.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/项目管理部焊缝检测委托单.frx index 659d3ff..936c6ea 100644 --- a/HJGL_DS/FineUIPro.Web/File/Fastreport/项目管理部焊缝检测委托单.frx +++ b/HJGL_DS/FineUIPro.Web/File/Fastreport/项目管理部焊缝检测委托单.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -42,7 +42,7 @@ namespace FastReport } - + diff --git a/HJGL_DS/FineUIPro.Web/HJGL/CheckManage/CheckRecordPrint.aspx.cs b/HJGL_DS/FineUIPro.Web/HJGL/CheckManage/CheckRecordPrint.aspx.cs index e634bb1..1993deb 100644 --- a/HJGL_DS/FineUIPro.Web/HJGL/CheckManage/CheckRecordPrint.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/HJGL/CheckManage/CheckRecordPrint.aspx.cs @@ -7,6 +7,7 @@ using System.Web.UI.WebControls; using BLL; using System.Data.SqlClient; using System.Data; +using System.IO; namespace FineUIPro.Web.HJGL.CheckManage { @@ -204,18 +205,18 @@ namespace FineUIPro.Web.HJGL.CheckManage string sTE_ID2 = Grid1.SelectedRowID.Split(',')[5]; string wME_Name = Grid1.SelectedRowID.Split(',')[6]; var trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustId); - List listStr = new List(); - listStr.Add(new SqlParameter("@CH_TrustID", trustId)); - listStr.Add(new SqlParameter("@ISO_ID", isoId)); - listStr.Add(new SqlParameter("@Desc", desc)); - listStr.Add(new SqlParameter("@Flag", "0")); - listStr.Add(new SqlParameter("@IsRepair", "0")); - listStr.Add(new SqlParameter("@STE_Code", sTE_Code)); - listStr.Add(new SqlParameter("@STE_ID", sTE_ID)); - listStr.Add(new SqlParameter("@STE_ID2", sTE_ID2)); - listStr.Add(new SqlParameter("@WME_Name", wME_Name)); - SqlParameter[] parameter = listStr.ToArray(); - DataTable tb = null; + //List listStr = new List(); + //listStr.Add(new SqlParameter("@CH_TrustID", trustId)); + //listStr.Add(new SqlParameter("@ISO_ID", isoId)); + //listStr.Add(new SqlParameter("@Desc", desc)); + //listStr.Add(new SqlParameter("@Flag", "0")); + //listStr.Add(new SqlParameter("@IsRepair", "0")); + //listStr.Add(new SqlParameter("@STE_Code", sTE_Code)); + //listStr.Add(new SqlParameter("@STE_ID", sTE_ID)); + //listStr.Add(new SqlParameter("@STE_ID2", sTE_ID2)); + //listStr.Add(new SqlParameter("@WME_Name", wME_Name)); + //SqlParameter[] parameter = listStr.ToArray(); + //DataTable tb = null; string isoNo = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(isoId).ISO_IsoNo; // PT,MT,UT调用一个存储过程 if (trust != null) @@ -224,9 +225,6 @@ namespace FineUIPro.Web.HJGL.CheckManage { if (!string.IsNullOrEmpty(trust.CH_NDTMethod)) { - //trust.Record_Printer = this.CurrUser.UserName; - //trust.Record_PrintDate = DateTime.Now; - //BLL.HJGL_TrustManageEditService.UpdateCH_Trust(trust); var trustItems = from x in Funs.DB.HJGL_CH_TrustItem join y in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals y.JOT_ID @@ -241,12 +239,15 @@ namespace FineUIPro.Web.HJGL.CheckManage trustItem.Record_PrintDate = DateTime.Now; BLL.HJGL_CH_TrustItemService.UpdateTrustItem(trustItem); } + string initTemplatePath = ""; + string rootPath = Server.MapPath("~/"); + BLL.Common.FastReportService.ResetData(); - string reportId1 = string.Empty;//报表Id - string reportId2 = string.Empty; - int rowNum = 0; - string varValue = string.Empty; - int count = 0; + //string reportId1 = string.Empty;//报表Id + //string reportId2 = string.Empty; + //int rowNum = 0; + //string varValue = string.Empty; + //int count = 0; var ndtType = BLL.HJGL_TestingService.GetTestingByTestingId(trust.CH_NDTMethod); if (ndtType.NDT_Code == "RT") @@ -258,10 +259,74 @@ namespace FineUIPro.Web.HJGL.CheckManage fileCode.FileId = trust.CH_TrustID; fileCode.FileCode2 = fileCode.FileCode.Replace(isoNo, ""); BLL.Base_PrintFileCodeService.AddPrintFileCode(fileCode); - reportId1 = BLL.Const.HJGL_RTCheckRecordReportId1; - reportId2 = BLL.Const.HJGL_RTCheckRecordReportId2; - rowNum = 18; - tb = BLL.SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_TrustItemRecordRT", parameter); + //reportId1 = BLL.Const.HJGL_RTCheckRecordReportId1; + //reportId2 = BLL.Const.HJGL_RTCheckRecordReportId2; + //rowNum = 18; + var listTitleStr = new List(); + listTitleStr.Add(new SqlParameter("@CH_TrustID", trustId)); + listTitleStr.Add(new SqlParameter("@ISO_ID", isoId)); + listTitleStr.Add(new SqlParameter("@IsRepair", "0")); + listTitleStr.Add(new SqlParameter("@Desc", desc)); + listTitleStr.Add(new SqlParameter("@Flag", null)); + listTitleStr.Add(new SqlParameter("@STE_Code", sTE_Code)); + SqlParameter[] titleparameter = listTitleStr.ToArray(); + var tbTitle = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_TrustRecord", titleparameter); + + //tb = BLL.SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_TrustItemRecordRT", parameter); + + + DataTable dt = new DataTable(); + dt.TableName = "MainData"; + dt.Columns.Add("ProjectName"); + //dt.Columns.Add("InstallastionName"); + //dt.Columns.Add("InstallatinCode"); + //dt.Columns.Add("TrustUnit"); + //dt.Columns.Add("TrustCode"); + //dt.Columns.Add("CheckUnit"); + //dt.Columns.Add("ItemName"); + //dt.Columns.Add("WME_Code"); + //dt.Columns.Add("IsHot"); + //dt.Columns.Add("JST_Name"); + //dt.Columns.Add("NDTR_Name"); + //dt.Columns.Add("NDT_Code"); + //dt.Columns.Add("AcceptGrade"); + //dt.Columns.Add("CH_NDTCriteria"); + + DataRow[] rows = tbTitle.DefaultView.ToTable().Select(); + foreach (var row in rows) + { + var newRow = dt.NewRow(); + newRow["ProjectName"] = row["ProjectName"].ToString(); + //newRow["InstallastionName"] = row["InstallationName"].ToString(); + //newRow["InstallatinCode"] = row["InstallationCode"].ToString(); + //newRow["TrustUnit"] = row["UnitName"].ToString(); + //newRow["TrustCode"] = row["CH_TrustCode"].ToString(); + //newRow["CheckUnit"] = row["CheckUnitName"].ToString(); + //newRow["ItemName"] = row["CH_ItemName"].ToString(); + //newRow["WME_Code"] = row["WME_Code"].ToString(); + //newRow["IsHot"] = "合格"; + //newRow["JST_Name"] = row["JST_Name"]; + //newRow["NDTR_Name"] = row["NDTR_Name"]; + //newRow["NDT_Code"] = row["NDT_Code"]; + + dt.Rows.Add(newRow); + } + BLL.Common.FastReportService.AddFastreportTable(dt); + + + //传参 + Dictionary keyValuePairs = new Dictionary(); + //keyValuePairs.Add("JointCount", jointCount.ToString()); + //keyValuePairs.Add("CheckCount", (rows.Count() - 1).ToString()); + BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs); + + initTemplatePath = "File\\Fastreport\\射线检测记录.frx"; + + if (File.Exists(rootPath + initTemplatePath)) + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../common/ReportPrint/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); + + } } @@ -310,23 +375,23 @@ namespace FineUIPro.Web.HJGL.CheckManage //} #endregion - count = tb.Rows.Count; - string pageNum = Funs.GetPagesCountByPageSize(rowNum, 20, count).ToString(); - varValue = pageNum; - varValue = HttpUtility.UrlEncodeUnicode(varValue); + //count = tb.Rows.Count; + //string pageNum = Funs.GetPagesCountByPageSize(rowNum, 20, count).ToString(); + //varValue = pageNum; + //varValue = HttpUtility.UrlEncodeUnicode(varValue); - if (tb.Rows.Count <= rowNum) - { - string replaceParameter = HttpUtility.UrlEncodeUnicode(trustId + "|" + isoId + "|" + "0" + "|" + desc + "|" + "1" + "|" + sTE_Code + "|" + sTE_ID + "|" + sTE_ID2 + "|" + wME_Name); - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", reportId1, replaceParameter, varValue))); - } - else - { - string replaceParameter1 = HttpUtility.UrlEncodeUnicode(trustId + "|" + isoId + "|" + "0" + "|" + desc + "|" + "1" + "|" + sTE_Code + "|" + sTE_ID + "|" + sTE_ID2 + "|" + wME_Name); - string replaceParameter2 = HttpUtility.UrlEncodeUnicode(trustId + "|" + isoId + "|" + "0" + "|" + desc + "|" + "2" + "|" + sTE_Code + "|" + sTE_ID + "|" + sTE_ID2 + "|" + wME_Name); - PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", reportId2, replaceParameter2, varValue))); - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", reportId1, replaceParameter1, varValue))); - } + //if (tb.Rows.Count <= rowNum) + //{ + // string replaceParameter = HttpUtility.UrlEncodeUnicode(trustId + "|" + isoId + "|" + "0" + "|" + desc + "|" + "1" + "|" + sTE_Code + "|" + sTE_ID + "|" + sTE_ID2 + "|" + wME_Name); + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", reportId1, replaceParameter, varValue))); + //} + //else + //{ + // string replaceParameter1 = HttpUtility.UrlEncodeUnicode(trustId + "|" + isoId + "|" + "0" + "|" + desc + "|" + "1" + "|" + sTE_Code + "|" + sTE_ID + "|" + sTE_ID2 + "|" + wME_Name); + // string replaceParameter2 = HttpUtility.UrlEncodeUnicode(trustId + "|" + isoId + "|" + "0" + "|" + desc + "|" + "2" + "|" + sTE_Code + "|" + sTE_ID + "|" + sTE_ID2 + "|" + wME_Name); + // PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", reportId2, replaceParameter2, varValue))); + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", reportId1, replaceParameter1, varValue))); + //} } } if (e.CommandName == "fileName")//文档名 diff --git a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecord.aspx b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecord.aspx index f1ace64..918b4b2 100644 --- a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecord.aspx +++ b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecord.aspx @@ -31,12 +31,15 @@ - + <%----%> + + - + - + diff --git a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecord.aspx.cs b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecord.aspx.cs index 247bc1d..b6d3128 100644 --- a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecord.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecord.aspx.cs @@ -29,6 +29,11 @@ namespace FineUIPro.Web.HJGL.WeldingReport this.drpJointType.DataBind(); Funs.FineUIPleaseSelect(this.drpJointType); + this.drpIsoId.DataTextField = "ISO_IsoNo"; + this.drpIsoId.DataValueField = "ISO_ID"; + this.drpIsoId.DataSource = (from x in Funs.DB.HJGL_PW_IsoInfo where x.ProjectId == drpProjectId.SelectedValue orderby x.ISO_IsoNo select x).ToList(); + this.drpIsoId.DataBind(); + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); this.txtEndDate.Text = DateTime.Now.ToShortDateString(); @@ -98,10 +103,10 @@ namespace FineUIPro.Web.HJGL.WeldingReport strSql += " AND batchDetail.VICheckDate <= @EndDate"; listStr.Add(new SqlParameter("@EndDate", Convert.ToDateTime(this.txtEndDate.Text))); } - if (!string.IsNullOrEmpty(this.txtIsoNo.Text.Trim())) + if (this.drpIsoId.SelectedValue != null && this.drpIsoId.SelectedValue != string.Empty) { - strSql += " AND isoinfo.ISO_IsoNo like @isoNo"; - listStr.Add(new SqlParameter("@isoNo", "%" + this.txtIsoNo.Text.Trim() + "%")); + strSql += " AND isoinfo.ISO_IsoNo = @isoNo"; + listStr.Add(new SqlParameter("@isoNo", this.drpIsoId.SelectedText.Trim())); } SqlParameter[] parameter = listStr.ToArray(); @@ -152,7 +157,12 @@ namespace FineUIPro.Web.HJGL.WeldingReport /// protected void Text_TextChanged(object sender, EventArgs e) { - BindGrid(); + this.drpIsoId.DataTextField = "ISO_IsoNo"; + this.drpIsoId.DataValueField = "ISO_ID"; + this.drpIsoId.DataSource = (from x in Funs.DB.HJGL_PW_IsoInfo where x.ProjectId == drpProjectId.SelectedValue orderby x.ISO_IsoNo select x).ToList(); + this.drpIsoId.DataBind(); + + //BindGrid(); } /// diff --git a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecord.aspx.designer.cs b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecord.aspx.designer.cs index 7df1250..f77a7dc 100644 --- a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecord.aspx.designer.cs +++ b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecord.aspx.designer.cs @@ -85,13 +85,13 @@ namespace FineUIPro.Web.HJGL.WeldingReport { protected global::FineUIPro.DropDownList drpProjectId; /// - /// txtIsoNo 控件。 + /// drpIsoId 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.TextBox txtIsoNo; + protected global::FineUIPro.DropDownList drpIsoId; /// /// drpJointType 控件。 diff --git a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecordItem.aspx.cs b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecordItem.aspx.cs index 9c89c3d..2824200 100644 --- a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecordItem.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WeldInspectionCheckRecordItem.aspx.cs @@ -208,7 +208,7 @@ namespace FineUIPro.Web.HJGL.WeldingReport //tb = GetFilteredTable(Grid1.FilteredData, tb); var table = this.GetPagedDataTable(Grid1, tb); Grid1.DataSource = table; - Grid1.DataBind(); + Grid1.DataBind(); } #endregion @@ -364,7 +364,7 @@ namespace FineUIPro.Web.HJGL.WeldingReport row["index"] = 0; } } - tb.Columns.Add("indexS", typeof(System.String)); + tb.Columns.Add("indexS", typeof(System.String)); foreach (DataRow row in tb.Rows) { try @@ -387,7 +387,7 @@ namespace FineUIPro.Web.HJGL.WeldingReport var newRows = dt.NewRow(); //if (i + 1 < rows.Count()) //{ - newRows["Number"] = i + 1; + newRows["Number"] = i + 1; //} newRows["WED_Code"] = row["WED_Code"].ToString(); newRows["ISO_IsoNo"] = row["ISO_IsoNo"].ToString(); @@ -417,7 +417,6 @@ namespace FineUIPro.Web.HJGL.WeldingReport { PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../common/ReportPrint/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); } - } @@ -482,7 +481,7 @@ namespace FineUIPro.Web.HJGL.WeldingReport List listStr = new List(); listStr.Add(new SqlParameter("@ProjectId", ProjectId)); - listStr.Add(new SqlParameter("@ISO_ID",this.ISO_ID)); + listStr.Add(new SqlParameter("@ISO_ID", this.ISO_ID)); listStr.Add(new SqlParameter("@VICheckDate", vICheckDate.Replace("/", "-"))); listStr.Add(new SqlParameter("@NDTR_ID", this.NDTR_ID)); listStr.Add(new SqlParameter("@JOTY_Group", JOTY_Group)); @@ -567,8 +566,16 @@ namespace FineUIPro.Web.HJGL.WeldingReport //传参 Dictionary keyValuePairs = new Dictionary(); keyValuePairs.Add("ProjectName", projectName); - keyValuePairs.Add("InspectionCount", tb.Rows.Count.ToString()+"个"); + keyValuePairs.Add("InspectionCount", tb.Rows.Count.ToString() + "个"); keyValuePairs.Add("NDTRName", ndtrName); + if (JOTY_Group == "1") + { + keyValuePairs.Add("NDTType", "RT"); + } + else + { + keyValuePairs.Add("NDTType", "PT"); + } BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs); initTemplatePath = "File\\Fastreport\\管道焊接接头报检检查记录.frx"; diff --git a/HJGL_DS/FineUIPro.Web/Web.config b/HJGL_DS/FineUIPro.Web/Web.config index bf404b8..97d6b43 100644 --- a/HJGL_DS/FineUIPro.Web/Web.config +++ b/HJGL_DS/FineUIPro.Web/Web.config @@ -11,7 +11,7 @@ - +