This commit is contained in:
2024-07-01 16:11:54 +08:00
parent c31f2ec994
commit f782a28659
4 changed files with 45 additions and 199 deletions
@@ -167,7 +167,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
{
Directory.CreateDirectory(filePath);
}
string ReportFileName = filePath + "无损检测委托单" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx";
string ReportFileName = filePath + "管道焊口检测委托单" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx";
//string ReportFileName = filePath + "out1.xlsx";
int totalNum = Grid1.SelectedRowIDArray.Length;
@@ -471,14 +471,14 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
}
else
{
if (hssfworkbook.GetSheet("无损检测委托单") != null)
if (hssfworkbook.GetSheet("管道焊口检测委托单") != null)
{
ws = (XSSFSheet)hssfworkbook.GetSheet("无损检测委托单");
ws = (XSSFSheet)hssfworkbook.GetSheet("管道焊口检测委托单");
}
else
{
rowIndex = 0;
ws = (XSSFSheet)hssfworkbook.CreateSheet("无损检测委托单");
ws = (XSSFSheet)hssfworkbook.CreateSheet("管道焊口检测委托单");
#region
@@ -494,7 +494,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
ws.SetColumnWidth(9, 5 * 256);
ws.SetColumnWidth(10, 8 * 256);
ws.SetColumnWidth(11, 11 * 256);
ws.SetColumnWidth(12, 13 * 256);
ws.SetColumnWidth(12, 8 * 256);
#endregion
}
@@ -515,14 +515,14 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
//行0
CellRangeAddress region = new CellRangeAddress(rowIndex, rowIndex + 3, 0, 2);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex).GetCell(0).SetCellValue(tbTitle.Rows[0]["PipelineCode"].ToString());
ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3543—G414");
ws.GetRow(rowIndex).GetCell(0).CellStyle = style;
ws.GetRow(rowIndex).GetCell(1).CellStyle = style;
ws.GetRow(rowIndex).GetCell(2).CellStyle = style;
region = new CellRangeAddress(rowIndex, rowIndex + 3, 3, 9);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("无损检测委托单");
ws.GetRow(rowIndex).GetCell(3).SetCellValue("管道焊口检测委托单");
ws.GetRow(rowIndex).GetCell(3).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 16, true, true);
ws.GetRow(rowIndex).GetCell(4).CellStyle = style;
ws.GetRow(rowIndex).GetCell(5).CellStyle = style;
@@ -531,37 +531,21 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
ws.GetRow(rowIndex).GetCell(8).CellStyle = style;
ws.GetRow(rowIndex).GetCell(9).CellStyle = style;
region = new CellRangeAddress(rowIndex, rowIndex, 10, 12);
region = new CellRangeAddress(rowIndex, rowIndex+1, 10, 12);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex).GetCell(10).SetCellValue(tbTitle.Rows[0]["ProjectName"].ToString());
ws.GetRow(rowIndex).GetCell(10).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Justify, 10.5, true, false);
ws.GetRow(rowIndex).GetCell(11).CellStyle = styleButton;
ws.GetRow(rowIndex).GetCell(12).CellStyle = styleButton;
//行1
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 10, 12);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex + 1).GetCell(10).SetCellValue("EnProjectName");
ws.GetRow(rowIndex + 1).GetCell(10).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Justify, 10.5, true, false);
ws.GetRow(rowIndex + 1).GetCell(11).CellStyle = styleNone;
ws.GetRow(rowIndex + 1).GetCell(12).CellStyle = styleNone;
//行2
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 10, 12);
region = new CellRangeAddress(rowIndex + 2, rowIndex + 3, 10, 12);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue(tbTitle.Rows[0]["WorkAreaName"].ToString());
ws.GetRow(rowIndex + 2).GetCell(10).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Justify, 10.5, true, false);
ws.GetRow(rowIndex + 2).GetCell(11).CellStyle = styleNone;
ws.GetRow(rowIndex + 2).GetCell(12).CellStyle = styleNone;
//行3
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 10, 12);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex + 3).GetCell(10).SetCellValue("EnWorkAreaName");
ws.GetRow(rowIndex + 3).GetCell(10).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Justify, 10.5, true, false);
ws.GetRow(rowIndex + 3).GetCell(11).CellStyle = styleTop;
ws.GetRow(rowIndex + 3).GetCell(12).CellStyle = styleTop;
//行4
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("检查单位");
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 1, 7);
@@ -573,6 +557,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 11, 12);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex + 4).GetCell(11).SetCellValue(tbTitle.Rows[0]["TrustBatchCode"].ToString());
ws.GetRow(rowIndex + 4).Height = 30 * 20;
//行5,
ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("探伤地点");
@@ -679,6 +664,8 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
ws.AddMergedRegion(region);
region = new CellRangeAddress(hb, hb, 8, 10);
ws.AddMergedRegion(region);
ws.GetRow(hb).Height = 33 * 20;
}
//获取当前页数据
var pageTb = GetPageToTable(tb, dStart, dEnd);
@@ -757,6 +744,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
//分页打印是操作
ws.SetRowBreak(rowIndex - 1);
ws.SetColumnBreak((short)13);
}
}
}
@@ -5,6 +5,7 @@ using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using BLL;
using NPOI.HSSF.Util;
using NPOI.SS.UserModel;
@@ -281,7 +282,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
lbTrustUnit.Text = trust.TrustUnit;
this.txtTrustBatchCode.Text = trust.TrustBatchCode;
this.txtTrustCode.Text= trust.TrustBatchCode;
this.txtTrustCode.Text = trust.TrustBatchCode;
//if (trust.TrustDate != null)
//{
// this.txtTrustDate.Text = string.Format("{0:yyyy-MM-dd}", trust.TrustDate);
@@ -449,7 +450,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
string surfaceState = drpSurfaceState.SelectedValue;
string detectionTiming = drpDetectionTiming.SelectedValue;
DateTime? trustDate= Funs.GetNewDateTime(this.txtTrustDate.Text);
DateTime? trustDate = Funs.GetNewDateTime(this.txtTrustDate.Text);
BLL.Batch_BatchTrustService.BatchTrustNDEUnit(trustBatchId, ndtUnit, trustCode, surfaceState, detectionTiming, null, null, trustDate);
txtTrustBatchCode.Text = trustCode;
ShowNotify(Resources.Lan.SaveSuccessfully, MessageBoxIcon.Success);
@@ -497,7 +498,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
db.SubmitChanges();
}
}
var check = from x in db.Batch_NDE where x.TrustBatchId == trustBatchId select x;
if (check.Count() > 0)
{
@@ -1258,7 +1259,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
int dataIndex = dataTit + j;
//检件编号
ws.GetRow(dataIndex).GetCell(0).SetCellValue(pageTb.Rows[j]["PipelineCode"].ToString());
//焊口号
ws.GetRow(dataIndex).GetCell(2).SetCellValue(pageTb.Rows[j]["WeldJointCode"].ToString());
//焊工代号
@@ -1274,7 +1275,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
{
ws.GetRow(dataTit + pageTb.Rows.Count).GetCell(0).SetCellValue("以下空白");
}
rowIndex += tIndex;
#endregion
@@ -1363,7 +1364,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
Response.Charset = "GB2312";
Response.ContentEncoding = System.Text.Encoding.UTF8;
// 添加头信息,为"文件下载/另存为"对话框指定默认文件名
Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(trustBatchCode+".xlsx"));
Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(trustBatchCode + ".xlsx"));
// 添加头信息,指定文件大小,让浏览器能够显示下载进度
Response.AddHeader("Content-Length", filet.Length.ToString());
// 指定返回的是一个不能被客户端读取的流,必须被下载
@@ -1692,14 +1693,14 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
}
else
{
if (hssfworkbook.GetSheet("无损检测委托单") != null)
if (hssfworkbook.GetSheet("管道焊口检测委托单") != null)
{
ws = (XSSFSheet)hssfworkbook.GetSheet("无损检测委托单");
ws = (XSSFSheet)hssfworkbook.GetSheet("管道焊口检测委托单");
}
else
{
rowIndex = 0;
ws = (XSSFSheet)hssfworkbook.CreateSheet("无损检测委托单");
ws = (XSSFSheet)hssfworkbook.CreateSheet("管道焊口检测委托单");
#region
@@ -1715,7 +1716,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
ws.SetColumnWidth(9, 5 * 256);
ws.SetColumnWidth(10, 8 * 256);
ws.SetColumnWidth(11, 11 * 256);
ws.SetColumnWidth(12, 13 * 256);
ws.SetColumnWidth(12, 8 * 256);
#endregion
}
@@ -1736,14 +1737,14 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
//行0
CellRangeAddress region = new CellRangeAddress(rowIndex, rowIndex + 3, 0, 2);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex).GetCell(0).SetCellValue("NDE-001");
ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3543—G414");
ws.GetRow(rowIndex).GetCell(0).CellStyle = style;
ws.GetRow(rowIndex).GetCell(1).CellStyle = style;
ws.GetRow(rowIndex).GetCell(2).CellStyle = style;
region = new CellRangeAddress(rowIndex, rowIndex + 3, 3, 9);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("无损检测委托单");
ws.GetRow(rowIndex).GetCell(3).SetCellValue("管道焊口检测委托单");
ws.GetRow(rowIndex).GetCell(3).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 16, true, true);
ws.GetRow(rowIndex).GetCell(4).CellStyle = style;
ws.GetRow(rowIndex).GetCell(5).CellStyle = style;
@@ -1752,36 +1753,22 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
ws.GetRow(rowIndex).GetCell(8).CellStyle = style;
ws.GetRow(rowIndex).GetCell(9).CellStyle = style;
region = new CellRangeAddress(rowIndex, rowIndex, 10, 12);
region = new CellRangeAddress(rowIndex, rowIndex + 1, 10, 12);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex).GetCell(10).SetCellValue(tbTitle.Rows[0]["ProjectName"].ToString());
ws.GetRow(rowIndex).GetCell(10).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Justify, 10.5, true, false);
ws.GetRow(rowIndex).GetCell(11).CellStyle = styleButton;
ws.GetRow(rowIndex).GetCell(12).CellStyle = styleButton;
//行1
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 10, 12);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex + 1).GetCell(10).SetCellValue(tbTitle.Rows[0]["EnProjectName"].ToString());
ws.GetRow(rowIndex + 1).GetCell(10).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Justify, 10.5, true, false);
ws.GetRow(rowIndex + 1).GetCell(11).CellStyle = styleNone;
ws.GetRow(rowIndex + 1).GetCell(12).CellStyle = styleNone;
//行2
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 10, 12);
region = new CellRangeAddress(rowIndex + 2, rowIndex + 3, 10, 12);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue(tbTitle.Rows[0]["WorkAreaName"].ToString());
ws.GetRow(rowIndex + 2).GetCell(10).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Justify, 10.5, true, false);
ws.GetRow(rowIndex + 2).GetCell(11).CellStyle = styleNone;
ws.GetRow(rowIndex + 2).GetCell(12).CellStyle = styleNone;
//行3
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 10, 12);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex + 3).GetCell(10).SetCellValue(tbTitle.Rows[0]["EnWorkAreaName"].ToString());
ws.GetRow(rowIndex + 3).GetCell(10).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Justify, 10.5, true, false);
ws.GetRow(rowIndex + 3).GetCell(11).CellStyle = styleTop;
ws.GetRow(rowIndex + 3).GetCell(12).CellStyle = styleTop;
//行4
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("检查单位");
@@ -1794,6 +1781,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 11, 12);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex + 4).GetCell(11).SetCellValue(tbTitle.Rows[0]["TrustBatchCode"].ToString());
ws.GetRow(rowIndex + 4).Height = 30 * 20;
//行5,
ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("探伤地点");
@@ -1852,7 +1840,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
//11-7=4
//行8
ws.GetRow(rowIndex + 8).GetCell(0).SetCellValue("序号");
ws.GetRow(rowIndex + 8).GetCell(0).SetCellValue("序号");
region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 1, 3);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex + 8).GetCell(1).SetCellValue("管道编号/单线号");
@@ -1864,7 +1852,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
ws.GetRow(rowIndex + 8).GetCell(6).SetCellValue("焊工号");
region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 8, 10);
ws.AddMergedRegion(region);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex + 8).GetCell(11).SetCellValue("检件规格");
ws.GetRow(rowIndex + 8).GetCell(8).SetCellValue("检件材质");
ws.GetRow(rowIndex + 8).GetCell(12).SetCellValue("备注");
@@ -1899,6 +1887,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
ws.AddMergedRegion(region);
region = new CellRangeAddress(hb, hb, 8, 10);
ws.AddMergedRegion(region);
ws.GetRow(hb).Height = 33 * 20;
}
//获取当前页数据
var pageTb = GetPageToTable(tb, dStart, dEnd);
@@ -1942,7 +1931,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
{
ws.GetRow(hb).GetCell(c).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10.5, true, false);
}
if (hb == rowIndex + 6 || hb == rowIndex + 7 )
if (hb == rowIndex + 6 || hb == rowIndex + 7)
{
ws.GetRow(hb).GetCell(c).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10.5, true, false);
}
@@ -1974,6 +1963,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
ws = WsExcelCreateRow(ws, hssfworkbook, rowIndex + 9, rowIndex + 9, style, 0, 12, 3, true);
rowIndex += 10;
ws.SetColumnBreak((short)12);
}
}
}
@@ -2037,7 +2027,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
for (int i = sRows; i <= eRows; i++)
{
ws.CreateRow(i);
if (excelpart==1)
if (excelpart == 1)
{
ws.GetRow(i).HeightInPoints =
i == sRows ? 27.75f :
@@ -2055,7 +2045,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
i == (sRows + 12) ? 23.25f :
17f;
}
else if(excelpart == 2)
else if (excelpart == 2)
{
ws.GetRow(i).HeightInPoints = 25.5f;