Merge branch 'master' of http://47.104.102.122:3000/shecs/Basf_TCC7
This commit is contained in:
		
						commit
						1f3e267e2a
					
				
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -14,6 +14,9 @@ using NPOI.HSSF.UserModel;
 | 
			
		|||
using NPOI.SS.Util;
 | 
			
		||||
using NPOI.SS.Formula.Functions;
 | 
			
		||||
using NPOI.OpenXmlFormats.Wordprocessing;
 | 
			
		||||
using System.Web.UI.WebControls;
 | 
			
		||||
using BorderStyle = NPOI.SS.UserModel.BorderStyle;
 | 
			
		||||
using System.Data.Linq;
 | 
			
		||||
 | 
			
		||||
namespace FineUIPro.Web.WeldingProcess.WeldingReport
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -127,7 +130,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
 | 
			
		|||
            Grid1.DataSource = table;
 | 
			
		||||
            Grid1.DataBind();
 | 
			
		||||
 | 
			
		||||
            if (tb.Rows.Count>0)
 | 
			
		||||
            if (tb.Rows.Count > 0)
 | 
			
		||||
            {
 | 
			
		||||
                // 合计
 | 
			
		||||
                var distinctPipelineCode = tb.AsEnumerable().GroupBy(row => row.Field<string>("PipelineCode")).Select(group => group.First());
 | 
			
		||||
| 
						 | 
				
			
			@ -236,146 +239,180 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
 | 
			
		|||
            int rowIndex = 0;
 | 
			
		||||
            var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 20, true, true, "微软雅黑");
 | 
			
		||||
 | 
			
		||||
            #region  头部
 | 
			
		||||
            ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex, style, 0, 19, true);
 | 
			
		||||
            ws.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(rowIndex, rowIndex, 0, 19));
 | 
			
		||||
            //设置表头文字
 | 
			
		||||
            ws.GetRow(rowIndex).GetCell(0).SetCellValue("焊接日报表\nWelding Daily Report");
 | 
			
		||||
            var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, true, true, "Arial");
 | 
			
		||||
 | 
			
		||||
            ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 2, style2, 0, 19, true);
 | 
			
		||||
            //设置表格表头
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("序号");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("管线号-页码");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(2).SetCellValue("图纸版本");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(3).SetCellValue("焊口号");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(4).SetCellValue("焊接形式");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(5).SetCellValue("焊接位置");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(6).SetCellValue("寸径");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(7).SetCellValue("规格");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(8).SetCellValue("焊工号");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(9).SetCellValue("组对部件1");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(10).SetCellValue("组件1材质");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue("组件1炉批号");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(12).SetCellValue("组对部件2");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(13).SetCellValue("组件2材质");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(14).SetCellValue("组件2炉批号");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(15).SetCellValue("焊接方法");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(16).SetCellValue("组对");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(17).SetCellValue("外观");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(18).SetCellValue("焊接日期");
 | 
			
		||||
            ws.GetRow(rowIndex + 1).GetCell(19).SetCellValue("备注");
 | 
			
		||||
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("S/N");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(1).SetCellValue("LineNo.-PageNo.");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue("Drawing\nRev");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue("Joint\nNo.");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue("JointType");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(5).SetCellValue("Welding\nLocation");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("Inch");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("Size");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("Welder\nNo.");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(9).SetCellValue("Part(1)");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue("Material(1)");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(11).SetCellValue("Heat\nNo.(1)");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(12).SetCellValue("Part(2)");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(13).SetCellValue("Material(2)");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(14).SetCellValue("Heat\nNo.(2)");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(15).SetCellValue("Weld\nProcess");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(16).SetCellValue("Fit\nUp");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(17).SetCellValue("VT");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(18).SetCellValue("Welding\nDate");
 | 
			
		||||
            ws.GetRow(rowIndex + 2).GetCell(19).SetCellValue("Remark");
 | 
			
		||||
 | 
			
		||||
            ws.GetRow(rowIndex).Height = 69 * 20;
 | 
			
		||||
            ws.GetRow(rowIndex + 1).Height = 12 * 20;
 | 
			
		||||
            ws.GetRow(rowIndex + 2).Height = 24 * 20;
 | 
			
		||||
 | 
			
		||||
            ws.SetColumnWidth(0, 4 * 256);
 | 
			
		||||
            ws.SetColumnWidth(1, (int)(22.67 * 256));
 | 
			
		||||
            ws.SetColumnWidth(2, (int)(9.78 * 256));
 | 
			
		||||
            ws.SetColumnWidth(3, (int)(6.78 * 256));
 | 
			
		||||
            ws.SetColumnWidth(4, (int)(7.67 * 256));
 | 
			
		||||
            ws.SetColumnWidth(5, (int)(8.33 * 256));
 | 
			
		||||
            ws.SetColumnWidth(6, (int)(6.33 * 256));
 | 
			
		||||
            ws.SetColumnWidth(7, (int)(9.11 * 256));
 | 
			
		||||
            ws.SetColumnWidth(8, (int)(8.33 * 256));
 | 
			
		||||
            ws.SetColumnWidth(9, (int)(7.44 * 256));
 | 
			
		||||
            ws.SetColumnWidth(10, (int)(15.67 * 256));
 | 
			
		||||
            ws.SetColumnWidth(11, (int)(11.67 * 256));
 | 
			
		||||
            ws.SetColumnWidth(12, (int)(8.22 * 256));
 | 
			
		||||
            ws.SetColumnWidth(13, (int)(16.33 * 256));
 | 
			
		||||
            ws.SetColumnWidth(14, (int)(11.22 * 256));
 | 
			
		||||
            ws.SetColumnWidth(15, (int)(10.44 * 256));
 | 
			
		||||
            ws.SetColumnWidth(16, (int)(5.56 * 256));
 | 
			
		||||
            ws.SetColumnWidth(17, (int)(5.56 * 256));
 | 
			
		||||
            ws.SetColumnWidth(18, (int)(7.89 * 256));
 | 
			
		||||
            ws.SetColumnWidth(19, (int)(9.33 * 256));
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            //#region 数据部分
 | 
			
		||||
            //DataTable dt = GetDataTable();
 | 
			
		||||
            //int totalCount = dt.Rows.Count;
 | 
			
		||||
            //int pageSize = 62;
 | 
			
		||||
            //var pageNum =
 | 
			
		||||
            //totalCount < pageSize ? 1
 | 
			
		||||
            //        : Math.Ceiling((float)(totalCount - pageSize) / pageSize) + 1;
 | 
			
		||||
            //var style3 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, false, false, "sans-serif");
 | 
			
		||||
 | 
			
		||||
            //for (int i = 1; i <= pageNum; i++)
 | 
			
		||||
            //{
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            #region 数据部分
 | 
			
		||||
            //    ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 3, rowIndex + 66, style3, 0, 19);
 | 
			
		||||
            //    var tIndex = 3 + rowIndex;
 | 
			
		||||
            //    var dStart = 0;
 | 
			
		||||
            //    var dEnd = 0;
 | 
			
		||||
            //    if (i == 1)
 | 
			
		||||
            //    {
 | 
			
		||||
            //        dStart = 0;
 | 
			
		||||
            //        dEnd = pageSize;
 | 
			
		||||
            //    }
 | 
			
		||||
            //    else
 | 
			
		||||
            //    {
 | 
			
		||||
            //        dStart = i == 2 ? pageSize : ((i - 2) * pageSize) + pageSize;
 | 
			
		||||
            //        dEnd = ((i - 1) * pageSize) + pageSize;
 | 
			
		||||
            //    }
 | 
			
		||||
 | 
			
		||||
            //    var pageTb = GetPageToTable(dt, dStart, dEnd);
 | 
			
		||||
            //    for (int j = 0; j < pageTb.Rows.Count; j++)
 | 
			
		||||
            //    {
 | 
			
		||||
            //        int dataIndex = tIndex + j;
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(0).SetCellValue(j + 1);
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(1).SetCellValue(pageTb.Rows[j]["SingleNumber"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(2).SetCellValue(pageTb.Rows[j]["DrawingsNum"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(3).SetCellValue(pageTb.Rows[j]["WeldJointCode"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(4).SetCellValue(pageTb.Rows[j]["WeldTypeCode"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(5).SetCellValue(pageTb.Rows[j]["WeldingLocationCode"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(6).SetCellValue(pageTb.Rows[j]["Size"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(7).SetCellValue(pageTb.Rows[j]["Specification"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(8).SetCellValue(pageTb.Rows[j]["WelderCode"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(9).SetCellValue(pageTb.Rows[j]["ComponentsName1"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(10).SetCellValue(pageTb.Rows[j]["MaterialCode1"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(11).SetCellValue(pageTb.Rows[j]["HeartNo1"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(12).SetCellValue(pageTb.Rows[j]["ComponentsName2"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(13).SetCellValue(pageTb.Rows[j]["MaterialCode2"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(14).SetCellValue(pageTb.Rows[j]["HeartNo2"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(15).SetCellValue(pageTb.Rows[j]["WeldingMethodName"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(16).SetCellValue("ACC");
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(17).SetCellValue("ACC");
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(18).SetCellValue(pageTb.Rows[j]["WeldingDate"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).GetCell(19).SetCellValue(pageTb.Rows[j]["Remark"].ToString());
 | 
			
		||||
            //        ws.GetRow(dataIndex).Height = 10 * 20;
 | 
			
		||||
            //    }
 | 
			
		||||
            //    rowIndex += tIndex + 63;
 | 
			
		||||
            //}
 | 
			
		||||
 | 
			
		||||
            //#endregion
 | 
			
		||||
            const int pageSize = 64;
 | 
			
		||||
            DataTable dt = GetDataTable();
 | 
			
		||||
            int totalCount = dt.Rows.Count;
 | 
			
		||||
            int pageSize = 62;
 | 
			
		||||
            var pageNum =
 | 
			
		||||
            totalCount < pageSize ? 1
 | 
			
		||||
                    : Math.Ceiling((float)(totalCount - pageSize) / pageSize) + 1;
 | 
			
		||||
            var style3 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, false, false, "sans-serif");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            for (int i = 1; i <= pageNum; i++)
 | 
			
		||||
            ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 3, dt.Rows.Count+3, style3, 0, 19);
 | 
			
		||||
            for (int i = 0; i < dt.Rows.Count; i++)
 | 
			
		||||
            {
 | 
			
		||||
                #region  头部
 | 
			
		||||
                ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex, style, 0, 19, true);
 | 
			
		||||
                ws.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(rowIndex, rowIndex, 0, 19));
 | 
			
		||||
                //设置表头文字
 | 
			
		||||
                ws.GetRow(rowIndex).GetCell(0).SetCellValue("焊接日报表\nWelding Daily Report");
 | 
			
		||||
                var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, true, true, "Arial");
 | 
			
		||||
 | 
			
		||||
                ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 2, style2, 0, 19, true);
 | 
			
		||||
                //设置表格表头
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("序号");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("管线号-页码");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(2).SetCellValue("图纸版本");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(3).SetCellValue("焊口号");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(4).SetCellValue("焊接形式");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(5).SetCellValue("焊接位置");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(6).SetCellValue("寸径");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(7).SetCellValue("规格");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(8).SetCellValue("焊工号");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(9).SetCellValue("组对部件1");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(10).SetCellValue("组件1材质");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue("组件1炉批号");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(12).SetCellValue("组对部件2");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(13).SetCellValue("组件2材质");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(14).SetCellValue("组件2炉批号");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(15).SetCellValue("焊接方法");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(16).SetCellValue("组对");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(17).SetCellValue("外观");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(18).SetCellValue("焊接日期");
 | 
			
		||||
                ws.GetRow(rowIndex + 1).GetCell(19).SetCellValue("备注");
 | 
			
		||||
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("S/N");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(1).SetCellValue("LineNo.-PageNo.");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue("Drawing\nRev");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue("Joint\nNo.");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue("JointType");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(5).SetCellValue("Welding\nLocation");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("Inch");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("Size");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("Welder\nNo.");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(9).SetCellValue("Part(1)");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue("Material(1)");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(11).SetCellValue("Heat\nNo.(1)");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(12).SetCellValue("Part(2)");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(13).SetCellValue("Material(2)");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(14).SetCellValue("Heat\nNo.(2)");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(15).SetCellValue("Weld\nProcess");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(16).SetCellValue("Fit\nUp");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(17).SetCellValue("VT");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(18).SetCellValue("Welding\nDate");
 | 
			
		||||
                ws.GetRow(rowIndex + 2).GetCell(19).SetCellValue("Remark");
 | 
			
		||||
 | 
			
		||||
                ws.GetRow(rowIndex).Height = 69 * 20;
 | 
			
		||||
                ws.GetRow(rowIndex + 1).Height = 12 * 20;
 | 
			
		||||
                ws.GetRow(rowIndex + 2).Height = 24 * 20;
 | 
			
		||||
 | 
			
		||||
                ws.SetColumnWidth(rowIndex, 4 * 256);
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 1, (int)(22.67 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 2, (int)(9.78 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 3, (int)(6.78 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 4, (int)(7.67 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 5, (int)(8.33 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 6, (int)(6.33 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 7, (int)(9.11 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 8, (int)(8.33 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 9, (int)(7.44 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 10, (int)(15.67 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 11, (int)(11.67 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 12, (int)(8.22 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 13, (int)(16.33 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 14, (int)(11.22 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 15, (int)(10.44 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 16, (int)(5.56 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 17, (int)(5.56 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 18, (int)(7.89 * 256));
 | 
			
		||||
                ws.SetColumnWidth(rowIndex + 19, (int)(9.33 * 256));
 | 
			
		||||
                #endregion
 | 
			
		||||
 | 
			
		||||
                ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 3, rowIndex + 64, style3, 0, 19);
 | 
			
		||||
                var tIndex = 3 + rowIndex;
 | 
			
		||||
                var dStart = 0;
 | 
			
		||||
                var dEnd = 0;
 | 
			
		||||
                if (i == 1)
 | 
			
		||||
                int startIndex = (i + 3);
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(0).SetCellValue(i + 1);
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(1).SetCellValue(dt.Rows[i]["SingleNumber"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(2).SetCellValue(dt.Rows[i]["DrawingsNum"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(3).SetCellValue(dt.Rows[i]["WeldJointCode"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(4).SetCellValue(dt.Rows[i]["WeldTypeCode"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(5).SetCellValue(dt.Rows[i]["WeldingLocationCode"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(6).SetCellValue(dt.Rows[i]["Size"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(7).SetCellValue(dt.Rows[i]["Specification"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(8).SetCellValue(dt.Rows[i]["WelderCode"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(9).SetCellValue(dt.Rows[i]["ComponentsName1"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(10).SetCellValue(dt.Rows[i]["MaterialCode1"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(11).SetCellValue(dt.Rows[i]["HeartNo1"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(12).SetCellValue(dt.Rows[i]["ComponentsName2"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(13).SetCellValue(dt.Rows[i]["MaterialCode2"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(14).SetCellValue(dt.Rows[i]["HeartNo2"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(15).SetCellValue(dt.Rows[i]["WeldingMethodName"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(16).SetCellValue("ACC");
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(17).SetCellValue("ACC");
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(18).SetCellValue(dt.Rows[i]["WeldingDate"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).GetCell(19).SetCellValue(dt.Rows[i]["Remark"].ToString());
 | 
			
		||||
                ws.GetRow(startIndex).Height = 10 * 20;
 | 
			
		||||
                if (startIndex == pageSize)
 | 
			
		||||
                {
 | 
			
		||||
                    dStart = 0;
 | 
			
		||||
                    dEnd = pageSize;
 | 
			
		||||
                    ws.SetRowBreak(startIndex);
 | 
			
		||||
                    startIndex += pageSize;
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    dStart = i == 2 ? pageSize : ((i - 2) * pageSize) + pageSize;
 | 
			
		||||
                    dEnd = ((i - 1) * pageSize) + pageSize;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                var pageTb = GetPageToTable(dt, dStart, dEnd);
 | 
			
		||||
                for (int j = 0; j < pageTb.Rows.Count; j++)
 | 
			
		||||
                {
 | 
			
		||||
                    int dataIndex = tIndex + j;
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(0).SetCellValue(j + 1);
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(1).SetCellValue(pageTb.Rows[j]["SingleNumber"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(2).SetCellValue(pageTb.Rows[j]["DrawingsNum"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(3).SetCellValue(pageTb.Rows[j]["WeldJointCode"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(4).SetCellValue(pageTb.Rows[j]["WeldTypeCode"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(5).SetCellValue(pageTb.Rows[j]["WeldingLocationCode"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(6).SetCellValue(pageTb.Rows[j]["Size"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(7).SetCellValue(pageTb.Rows[j]["Specification"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(8).SetCellValue(pageTb.Rows[j]["WelderCode"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(9).SetCellValue(pageTb.Rows[j]["ComponentsName1"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(10).SetCellValue(pageTb.Rows[j]["MaterialCode1"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(11).SetCellValue(pageTb.Rows[j]["HeartNo1"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(12).SetCellValue(pageTb.Rows[j]["ComponentsName2"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(13).SetCellValue(pageTb.Rows[j]["MaterialCode2"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(14).SetCellValue(pageTb.Rows[j]["HeartNo2"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(15).SetCellValue(pageTb.Rows[j]["WeldingMethodName"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(16).SetCellValue("ACC");
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(17).SetCellValue("ACC");
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(18).SetCellValue(pageTb.Rows[j]["WeldingDate"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).GetCell(19).SetCellValue(pageTb.Rows[j]["Remark"].ToString());
 | 
			
		||||
                    ws.GetRow(dataIndex).Height = 10 * 20;
 | 
			
		||||
                }
 | 
			
		||||
                rowIndex += tIndex + 62;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region 页脚部分
 | 
			
		||||
            IFooter footer = ws.Footer;
 | 
			
		||||
            string str= "CC7:                                                                                                                监理:                                                                                                                Worley:";
 | 
			
		||||
            string str = "CC7:                                                                                                                监理:                                                                                                                Worley:";
 | 
			
		||||
            str += "\n\n第 &P 页,共 &N 页";
 | 
			
		||||
            footer.Center = str;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -399,6 +436,8 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
 | 
			
		|||
            ws.PrintSetup.FitWidth = 1;
 | 
			
		||||
            ws.PrintSetup.FitHeight = 0;
 | 
			
		||||
            ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
 | 
			
		||||
            ws.RepeatingRows = new NPOI.SS.Util.CellRangeAddress(0,2, 0, 19);
 | 
			
		||||
 | 
			
		||||
            using (FileStream filess = System.IO.File.OpenWrite(ReportFileName))
 | 
			
		||||
            {
 | 
			
		||||
                hssfworkbook.Write(filess);
 | 
			
		||||
| 
						 | 
				
			
			@ -549,7 +588,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
 | 
			
		|||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                weldMaterial= silkName.Substring(0, silkName.Length - 1);
 | 
			
		||||
                                weldMaterial = silkName.Substring(0, silkName.Length - 1);
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue