This commit is contained in:
jackchenyang
2024-06-24 17:41:45 +08:00
parent 1be4905996
commit 91ca5b1b6b
15 changed files with 352 additions and 148 deletions
@@ -3640,9 +3640,9 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
private void template21(XSSFWorkbook hssfworkbook, XSSFSheet ws)
{
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
//获取签名
var getInfo =BLL.Sys_UserService.GetSingtrueImageUrl(info?.Auditer);
////模拟数据
//string sql = "SELECT '' WeldSilkId,'模拟数据' PipelineCode,'' WorkAreaCode,'' WeldJointCode,'' Specification,'' Material1Code,'' WeldingMethodCode,'' WeldingDate,'' WeldSilkCode,'' WeldMatCode,'' BackingWelderCode,'' CoverWelderCode,'' ProjectName,'' EnProjectName,'' WorkAreaName,'' EnWorkAreaName,'' IsHotProessName,'' PrepareTemp,'' WeldingLocationCode,'' WeldTypeCode,'' NDEReportNo\r\nFROM Sys_User union all SELECT '' WeldSilkId,'模拟数据' PipelineCode,'' WorkAreaCode,'' WeldJointCode,'' Specification,'' Material1Code,'' WeldingMethodCode,'' WeldingDate,'' WeldSilkCode,'' WeldMatCode,'' BackingWelderCode,'' CoverWelderCode,'' ProjectName,'' EnProjectName,'' WorkAreaName,'' EnWorkAreaName,'' IsHotProessName,'' PrepareTemp,'' WeldingLocationCode,'' WeldTypeCode,'' NDEReportNo\r\nFROM Sys_User union all SELECT '' WeldSilkId,'模拟数据' PipelineCode,'' WorkAreaCode,'' WeldJointCode,'' Specification,'' Material1Code,'' WeldingMethodCode,'' WeldingDate,'' WeldSilkCode,'' WeldMatCode,'' BackingWelderCode,'' CoverWelderCode,'' ProjectName,'' EnProjectName,'' WorkAreaName,'' EnWorkAreaName,'' IsHotProessName,'' PrepareTemp,'' WeldingLocationCode,'' WeldTypeCode,'' NDEReportNo\r\nFROM Sys_User";
string sql = @" SELECT
WeldSilkId,
@@ -3936,11 +3936,30 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
ws.AddMergedRegion(region);
}
if(!string.IsNullOrEmpty(getInfo.Item1) && !string.IsNullOrEmpty(getInfo.Item2))
{
switch (getInfo.Item2)
{
case "建设方":
InsertImage(hssfworkbook, ws, rowIndex + 3, 0, rowIndex + 3, 3, Server.MapPath(getInfo.Item1), 1, 1);
break;
case "总承包商":
InsertImage(hssfworkbook, ws, rowIndex + 3, 4, rowIndex + 3, 9, Server.MapPath(getInfo.Item1), 1, 1);
break;
case "监理":
InsertImage(hssfworkbook, ws, rowIndex + 3, 0, rowIndex + 3, 3, Server.MapPath(getInfo.Item1), 1, 1);
break;
case "施工":
InsertImage(hssfworkbook, ws, rowIndex + 3, 10, rowIndex + 3, 14, Server.MapPath(getInfo.Item1), 1, 1);
break;
}
}
//行1
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("建设/监理单位");
ws.GetRow(rowIndex + 1).GetCell(4).SetCellValue("总承包单位\r\nGeneral Contractor");
ws.GetRow(rowIndex + 1).GetCell(10).SetCellValue("施工单位\r\nConstruction Contractor");
//行2
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("专业工程师\r\nDiscipline Engineer:");
ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue("专业工程师\r\nDiscipline Engineer:");
ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue("记录人 \r\nRecord Prepared by:");
@@ -3949,7 +3968,7 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
//行5
ws.GetRow(rowIndex + 6).GetCell(10).SetCellValue("焊接责任工程师:\r\nWelding Engineer:");
//行6
ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("日期Date 年 月 日");
ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("日期Date 年 月 日");
ws.GetRow(rowIndex + 7).GetCell(4).SetCellValue("日期Date 年 月 日");
ws.GetRow(rowIndex + 7).GetCell(10).SetCellValue("日期Date 年 月 日");
@@ -3970,31 +3989,16 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
ws.VerticallyCenter = true;
ws.HorizontallyCenter = true;
//ws.PrintSetup.FitWidth = 1;
//ws.PrintSetup.FitHeight = 0;
//ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
//ws.FitToPage = true;
////横向打印
//ws.PrintSetup.Landscape = true;
////垂直水平居中
//ws.VerticallyCenter = true;
//ws.HorizontallyCenter = true;
////打印边距设置 厘米/3
//ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
//ws.SetMargin(MarginType.LeftMargin, (double)2.4 / 3);
//ws.SetMargin(MarginType.TopMargin, (double)2.9 / 3);
//ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
////页眉页脚间距
//ws.SetMargin(MarginType.HeaderMargin, 0);
//ws.SetMargin(MarginType.FooterMargin, 0);
}
//22-射线检测比例确认表SHT 3503-J412-2007
private void template22(XSSFWorkbook hssfworkbook, XSSFSheet ws)
{
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
//获取签名
var getInfo = BLL.Sys_UserService.GetSingtrueImageUrl(info?.Auditer);
string sql = @"
select * from (
@@ -4413,6 +4417,29 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 10, 16));
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 17, 20));
if (!string.IsNullOrEmpty(getInfo.Item1) && !string.IsNullOrEmpty(getInfo.Item2))
{
switch (getInfo.Item2)
{
case "建设方":
InsertImage(hssfworkbook, ws, rowIndex + 20, 0, rowIndex + 20, 3, Server.MapPath(getInfo.Item1), 1, 1,1);
break;
case "总承包商":
InsertImage(hssfworkbook, ws, rowIndex + 20, 4, rowIndex + 20, 9, Server.MapPath(getInfo.Item1), 1, 1,1);
break;
case "监理":
InsertImage(hssfworkbook, ws, rowIndex + 20, 0, rowIndex + 20, 3, Server.MapPath(getInfo.Item1), 1, 1,1);
break;
case "检测":
InsertImage(hssfworkbook, ws, rowIndex + 19, 10, rowIndex + 19, 16, Server.MapPath(getInfo.Item1), 1, 1,1);
break;
case "施工":
InsertImage(hssfworkbook, ws, rowIndex + 20, 17, rowIndex + 20, 20, Server.MapPath(getInfo.Item1), 1, 1,1);
break;
}
}
ws.GetRow(rowIndex + 17).GetCell(0).SetCellValue("建设/监理单位\r\nOwner/Supervision Contractor");
ws.GetRow(rowIndex + 17).GetCell(4).SetCellValue("总承包单位\r\nGeneral Contractor");
ws.GetRow(rowIndex + 17).GetCell(10).SetCellValue("检 测 单 位\r\nExamination Contractor");
@@ -4487,23 +4514,7 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
ws.VerticallyCenter = true;
ws.HorizontallyCenter = true;
//ws.PrintSetup.FitWidth = 1;
//ws.PrintSetup.FitHeight = 0;
//ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
//ws.FitToPage = true;
////横向打印
//ws.PrintSetup.Landscape = true;
////垂直水平居中
//ws.VerticallyCenter = true;
//ws.HorizontallyCenter = true;
////打印边距设置 厘米/3
//ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
//ws.SetMargin(MarginType.LeftMargin, (double)2.4 / 3);
//ws.SetMargin(MarginType.TopMargin, (double)2.9 / 3);
//ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
////页眉页脚间距
//ws.SetMargin(MarginType.HeaderMargin, 0);
//ws.SetMargin(MarginType.FooterMargin, 0);
}
//23-TP-09-超声&PAUT&TOFD检测比例确认表
@@ -7736,6 +7747,7 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
workAreaName = d.WorkAreaName,
workAreaCode = d.WorkAreaCode,
SystemNo = a.TestPackageName,
Auditer = a.Auditer,
testpackageNo = a.TestPackageNo,
TestPressure = a.TestPressure,
TestType = a.TestType
@@ -7743,6 +7755,7 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
return result;
}
/// <summary>
/// 查询指定条数分页
/// </summary>
@@ -239,6 +239,11 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
if (tb.Rows.Count > 0 && tbTitle.Rows.Count > 0)
{
string jlAuditer = tb.Rows[0]["JLAuditID"].ToString();
string glgsAuditer = tb.Rows[0]["GLGSAuditID"].ToString();
var getJLInfo = BLL.Sys_UserService.GetSingtrueImageUrl(jlAuditer);
var getGLGSInfo = BLL.Sys_UserService.GetSingtrueImageUrl(glgsAuditer);
var tbNum = tb.Rows.Count;
var pageNum =
tbNum < 17 ? 1
@@ -247,6 +252,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
//循环页
for (int i = 1; i <= pageNum; i++)
{
#region
ws = ClExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 5, style, 0, 20, true);
@@ -461,7 +467,15 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
ws.GetRow(rowIndex + 8).GetCell(9).SetCellValue("年 月 日");
ws.GetRow(rowIndex + 8).GetCell(12).SetCellValue("年 月 日");
ws.GetRow(rowIndex + 8).GetCell(18).SetCellValue("年 月 日");
//插入签名图片
if (!string.IsNullOrEmpty(getJLInfo.Item1))
{
InsertImage(hssfworkbook, ws, rowIndex + 6, 2, rowIndex + 6, 4, Server.MapPath(getJLInfo.Item1), 1, 1, 10);
}
if (!string.IsNullOrEmpty(getGLGSInfo.Item1))
{
InsertImage(hssfworkbook, ws, rowIndex + 6, 5, rowIndex + 6, 6, Server.MapPath(getJLInfo.Item1), 1, 8);
}
#endregion
ws = ClExcelCreateRow(ws, hssfworkbook, rowIndex + 9, rowIndex + 9, style, 0, 20, false, true);
@@ -502,6 +516,11 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
if (tb.Rows.Count > 0 && tbTitle.Rows.Count > 0)
{
string jlAuditer = tb.Rows[0]["JLAuditID"].ToString();
string glgsAuditer = tb.Rows[0]["GLGSAuditID"].ToString();
var getJLInfo = BLL.Sys_UserService.GetSingtrueImageUrl(jlAuditer);
var getGLGSInfo = BLL.Sys_UserService.GetSingtrueImageUrl(glgsAuditer);
var tbNum = tb.Rows.Count;
var pageNum =
tbNum < 15 ? 1
@@ -792,8 +811,16 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
ws.GetRow(rowIndex + 8).GetCell(7).SetCellValue(" 年 月 日");
ws.GetRow(rowIndex + 8).GetCell(11).SetCellValue(" 年 月 日");
//尾部行9
//插入签名图片
if (!string.IsNullOrEmpty(getJLInfo.Item1))
{
InsertImage(hssfworkbook, ws, rowIndex + 6, 2, rowIndex + 6, 4, Server.MapPath(getJLInfo.Item1), 1, 1, 10);
}
if (!string.IsNullOrEmpty(getGLGSInfo.Item1))
{
InsertImage(hssfworkbook, ws, rowIndex + 6, 5, rowIndex + 6, 6, Server.MapPath(getJLInfo.Item1), 1, 8);
}
#endregion
ws = WsExcelCreateRow(ws, hssfworkbook, rowIndex + 11, rowIndex + 11, style, 0, 12, 3, true);
@@ -849,7 +876,16 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
#endregion
#region
private void InsertImage(XSSFWorkbook hssfworkbook, XSSFSheet ws, int row1, int col1, int row2, int col2, string img, double w, double h, int dx1 = 0, int dy1 = 0, int dx2 = 0, int dy2 = 0)
{
int pictureIdx = hssfworkbook.AddPicture(System.IO.File.ReadAllBytes(img), PictureType.PNG);
IDrawing drawing = ws.CreateDrawingPatriarch();
IClientAnchor anchor = new XSSFClientAnchor(dx1 * XSSFShape.EMU_PER_PIXEL, dy1 * XSSFShape.EMU_PER_POINT, dx2 * XSSFShape.EMU_PER_PIXEL, dy2 * XSSFShape.EMU_PER_POINT, col1, row1, col2, row2);
IDrawing patriarch = ws.CreateDrawingPatriarch();
IPicture pict = (XSSFPicture)patriarch.CreatePicture(anchor, pictureIdx);
pict.Resize(w, h);
}
/// <summary>
/// 获取某一列的所有值
/// </summary>
@@ -727,6 +727,9 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
XSSFWorkbook hssfworkbook = new XSSFWorkbook();
XSSFSheet ws = new XSSFSheet();
string trustBatchId = this.tvControlItem.SelectedNodeID;
//头部
var listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@TrustBatchId", trustBatchId));
@@ -1049,6 +1052,11 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
if (tb.Rows.Count > 0 && tbTitle.Rows.Count > 0)
{
string jlAuditer = tb.Rows[0]["JLAuditID"].ToString();
string glgsAuditer = tb.Rows[0]["GLGSAuditID"].ToString();
var getJLInfo = BLL.Sys_UserService.GetSingtrueImageUrl(jlAuditer);
var getGLGSInfo=BLL.Sys_UserService.GetSingtrueImageUrl(glgsAuditer);
var tbNum = tb.Rows.Count;
var pageNum =
tbNum < 15 ? 1
@@ -1311,6 +1319,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
region = new CellRangeAddress(hb, hb, 11, 12);
ws.AddMergedRegion(region);
}
//尾部行1
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("施工单位");
ws.GetRow(rowIndex + 1).GetCell(2).SetCellValue("监理单位");
@@ -1346,7 +1355,15 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
}
ws.GetRow(rowIndex + 8).GetCell(7).SetCellValue(" 年 月 日");
ws.GetRow(rowIndex + 8).GetCell(11).SetCellValue(" 年 月 日");
//插入签名图片
if (!string.IsNullOrEmpty(getJLInfo.Item1))
{
InsertImage(hssfworkbook, ws, rowIndex + 6, 2, rowIndex + 6, 4, Server.MapPath(getJLInfo.Item1), 1, 1,10);
}
if (!string.IsNullOrEmpty(getGLGSInfo.Item1))
{
InsertImage(hssfworkbook, ws, rowIndex + 6, 5, rowIndex + 6, 6, Server.MapPath(getJLInfo.Item1), 1, 8);
}
//尾部行9
#endregion
@@ -1394,7 +1411,16 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
}
#region
private void InsertImage(XSSFWorkbook hssfworkbook, XSSFSheet ws, int row1, int col1, int row2, int col2, string img, double w, double h, int dx1 = 0, int dy1 = 0, int dx2 = 0, int dy2 = 0)
{
int pictureIdx = hssfworkbook.AddPicture(System.IO.File.ReadAllBytes(img), PictureType.PNG);
IDrawing drawing = ws.CreateDrawingPatriarch();
IClientAnchor anchor = new XSSFClientAnchor(dx1 * XSSFShape.EMU_PER_PIXEL, dy1 * XSSFShape.EMU_PER_POINT, dx2 * XSSFShape.EMU_PER_PIXEL, dy2 * XSSFShape.EMU_PER_POINT, col1, row1, col2, row2);
IDrawing patriarch = ws.CreateDrawingPatriarch();
IPicture pict = (XSSFPicture)patriarch.CreatePicture(anchor, pictureIdx);
pict.Resize(w, h);
}
/// <summary>
/// 获取某一列的所有值
/// </summary>