7893 lines
456 KiB
C#
7893 lines
456 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Data.SqlClient;
|
||
using System.Diagnostics;
|
||
using System.Drawing;
|
||
using System.Drawing.Imaging;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Reflection;
|
||
using System.Runtime.InteropServices;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using System.Windows.Forms;
|
||
using BLL;
|
||
using FineUIPro.Web.Common.ProjectSet;
|
||
using Model;
|
||
using Model.ViewModels;
|
||
using Newtonsoft.Json.Linq;
|
||
using NPOI.HSSF.UserModel;
|
||
using NPOI.SS.UserModel;
|
||
using NPOI.SS.Util;
|
||
using NPOI.XSSF.Streaming;
|
||
using NPOI.XSSF.UserModel;
|
||
using BorderStyle = NPOI.SS.UserModel.BorderStyle;
|
||
using HorizontalAlignment = NPOI.SS.UserModel.HorizontalAlignment;
|
||
|
||
namespace FineUIPro.Web.WeldingProcess.TestPackageManage
|
||
{
|
||
public partial class TestPackageManageAudit : PageBase
|
||
{
|
||
#region 定义项
|
||
/// <summary>
|
||
/// 试压包主键
|
||
/// </summary>
|
||
public string PTP_ID
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["PTP_ID"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["PTP_ID"] = value;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 未通过数
|
||
/// </summary>
|
||
public int Count
|
||
{
|
||
get
|
||
{
|
||
return (int)ViewState["Count"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["Count"] = value;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 加载页面
|
||
/// <summary>
|
||
/// 加载页面
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
||
this.PTP_ID = string.Empty;
|
||
this.txtSearchDate.Text = string.Format("{0:yyyy-MM}", System.DateTime.Now);
|
||
this.GetBindDropPrintList();
|
||
//打印报表项
|
||
// 审核人
|
||
BLL.Project_UserService.InitProjectUserDropDownList(drpAuditMan, true, this.CurrUser.LoginProjectId, Resources.Lan.PleaseSelect);
|
||
this.InitTreeMenu();//加载树
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 绑定下拉打印列表
|
||
private void GetBindDropPrintList()
|
||
{
|
||
this.drpPrintTypeList.DataSource = BLL.Common_ReportPrintService.TestPackageSelectPrint();
|
||
this.drpPrintTypeList.DataTextField = "Title";
|
||
this.drpPrintTypeList.DataValueField = "Id";
|
||
this.drpPrintTypeList.DataBind();
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 加载树装置-单位-工作区
|
||
/// <summary>
|
||
/// 加载树
|
||
/// </summary>
|
||
private void InitTreeMenu()
|
||
{
|
||
this.tvControlItem.Nodes.Clear();
|
||
TreeNode rootNode = new TreeNode();
|
||
rootNode.Text = "单位-装置-月份";
|
||
rootNode.NodeID = "0";
|
||
rootNode.Expanded = true;
|
||
this.tvControlItem.Nodes.Add(rootNode);
|
||
DateTime startTime = Convert.ToDateTime(this.txtSearchDate.Text.Trim() + "-01");
|
||
DateTime endTime = startTime.AddMonths(1);
|
||
|
||
List<Model.Base_Unit> units = new List<Model.Base_Unit>(); ///单位
|
||
var pUnit = BLL.Project_UnitService.GetProject_UnitByProjectIdUnitId(this.CurrUser.LoginProjectId, this.CurrUser.UnitId);
|
||
|
||
if (pUnit == null || pUnit.UnitType == BLL.Const.UnitType_1 || pUnit.UnitType == BLL.Const.UnitType_2
|
||
|| pUnit.UnitType == BLL.Const.UnitType_3 || pUnit.UnitType == BLL.Const.UnitType_4)
|
||
{
|
||
units = (from x in Funs.DB.Base_Unit
|
||
join y in Funs.DB.Project_Unit on x.UnitId equals y.UnitId
|
||
where y.ProjectId == this.CurrUser.LoginProjectId && y.UnitType.Contains(BLL.Const.UnitType_5)
|
||
select x).ToList();
|
||
}
|
||
else
|
||
{
|
||
units.Add(BLL.Base_UnitService.GetUnit(this.CurrUser.UnitId));
|
||
}
|
||
|
||
List<Model.PTP_TestPackage> testPackageLists = (from x in Funs.DB.PTP_TestPackage
|
||
where x.ProjectId == this.CurrUser.LoginProjectId && x.TableDate >= startTime && x.TableDate < endTime
|
||
select x).ToList();
|
||
if (units != null)
|
||
{
|
||
foreach (var unit in units)
|
||
{
|
||
TreeNode rootUnitNode = new TreeNode();//定义根节点
|
||
rootUnitNode.Text = unit.UnitName;
|
||
rootUnitNode.NodeID = unit.UnitId;
|
||
rootUnitNode.Expanded = true;
|
||
rootUnitNode.ToolTip = "施工单位";
|
||
rootNode.Nodes.Add(rootUnitNode);
|
||
var testPackageUnitList = testPackageLists.Where(x => x.UnitId == unit.UnitId).ToList();
|
||
this.BindNodes(rootUnitNode, testPackageUnitList);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请先增加施工单位!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 绑定树节点
|
||
/// <summary>
|
||
/// 绑定树节点
|
||
/// </summary>
|
||
/// <param name="node"></param>
|
||
private void BindNodes(TreeNode node, List<Model.PTP_TestPackage> testPackageUnitList)
|
||
{
|
||
if (node.ToolTip == "施工单位")
|
||
{
|
||
var installId = (from x in testPackageUnitList
|
||
where x.UnitId == node.NodeID
|
||
select x.InstallationId).Distinct();
|
||
if (installId.Count() > 0)
|
||
{
|
||
var install = from x in Funs.DB.Project_Installation
|
||
where installId.Contains(x.InstallationId)
|
||
orderby x.InstallationCode
|
||
select x;
|
||
foreach (var q in install)
|
||
{
|
||
TreeNode newNode = new TreeNode();
|
||
newNode.Text = q.InstallationName;
|
||
newNode.NodeID = q.InstallationId + "|" + node.NodeID;
|
||
newNode.ToolTip = "装置";
|
||
newNode.Expanded = true;
|
||
node.Nodes.Add(newNode);
|
||
this.BindNodes(newNode, testPackageUnitList);
|
||
}
|
||
}
|
||
}
|
||
else if (node.ToolTip == "装置")
|
||
{
|
||
string installationId = Funs.GetStrListByStr(node.NodeID, '|')[0];
|
||
var pointListMonth = (from x in testPackageUnitList
|
||
where x.InstallationId == installationId
|
||
select string.Format("{0:yyyy-MM}", x.TableDate)).Distinct();
|
||
foreach (var item in pointListMonth)
|
||
{
|
||
TreeNode newNode = new TreeNode();
|
||
newNode.Text = item;
|
||
newNode.NodeID = item + "|" + node.NodeID;
|
||
newNode.ToolTip = "月份";
|
||
node.Nodes.Add(newNode);
|
||
this.BindNodes(newNode, testPackageUnitList);
|
||
}
|
||
}
|
||
//else if (node.ToolTip == "月份")
|
||
//{
|
||
// string installationId = Funs.GetStrListByStr(node.ParentNode.NodeID, '|')[0];
|
||
// var days = (from x in testPackageUnitList
|
||
// where x.InstallationId == installationId
|
||
// orderby x.TableDate descending
|
||
// select x.TableDate).Distinct();
|
||
// foreach (var item in days)
|
||
// {
|
||
// TreeNode newNode = new TreeNode();
|
||
// newNode.Text = string.Format("{0:yyyy-MM-dd}", item);
|
||
// newNode.NodeID = item.ToString() + "|" + node.NodeID;
|
||
// newNode.ToolTip = "日期";
|
||
// node.Nodes.Add(newNode);
|
||
// this.BindNodes(newNode, testPackageUnitList);
|
||
// }
|
||
//}
|
||
else if (node.ToolTip == "月份")
|
||
{
|
||
DateTime startTime = Convert.ToDateTime(this.txtSearchDate.Text.Trim() + "-01");
|
||
DateTime endTime = startTime.AddMonths(1);
|
||
string installationId = Funs.GetStrListByStr(node.ParentNode.NodeID, '|')[0];
|
||
var dReports = from x in testPackageUnitList
|
||
where x.InstallationId == installationId
|
||
&& x.TableDate >= startTime && x.TableDate < endTime
|
||
orderby x.TestPackageNo descending
|
||
select x;
|
||
foreach (var item in dReports)
|
||
{
|
||
TreeNode newNode = new TreeNode();
|
||
if (!string.IsNullOrEmpty(item.TestPackageNo))
|
||
{
|
||
newNode.Text = item.TestPackageNo;
|
||
}
|
||
else
|
||
{
|
||
newNode.Text = "未知";
|
||
}
|
||
if (!item.AduditDate.HasValue || string.IsNullOrEmpty(item.Auditer))
|
||
{
|
||
newNode.Text = "<font color='#FF7575'>" + newNode.Text + "</font>";
|
||
node.Text = "<font color='#FF7575'>" + node.Text + "</font>";
|
||
node.ParentNode.Text = "<font color='#FF7575'>" + node.ParentNode.Text + "</font>";
|
||
}
|
||
newNode.NodeID = item.PTP_ID;
|
||
newNode.EnableClickEvent = true;
|
||
node.Nodes.Add(newNode);
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 点击TreeView
|
||
/// <summary>
|
||
/// 点击TreeView
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
||
{
|
||
this.PTP_ID = tvControlItem.SelectedNodeID;
|
||
this.BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 数据绑定
|
||
/// <summary>
|
||
/// 数据绑定
|
||
/// </summary>
|
||
private void BindGrid()
|
||
{
|
||
this.SetTextTemp();
|
||
this.PageInfoLoad(); ///页面输入保存信息
|
||
string strSql = @"SELECT * FROM dbo.View_PTP_TestPackageAudit
|
||
WHERE ProjectId= @ProjectId AND PTP_ID=@PTP_ID";
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||
listStr.Add(new SqlParameter("@PTP_ID", this.PTP_ID));
|
||
SqlParameter[] parameter = listStr.ToArray();
|
||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||
// 2.获取当前分页数据
|
||
//var table = this.GetPagedDataTable(Grid1, tb1);
|
||
Grid1.RecordCount = tb.Rows.Count;
|
||
var table = this.GetPagedDataTable(Grid1, tb);
|
||
Grid1.DataSource = table;
|
||
Grid1.DataBind();
|
||
this.ShowGridItem();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 行颜色设置
|
||
/// </summary>
|
||
private void ShowGridItem()
|
||
{
|
||
Count = 0;
|
||
int Count1 = 0, Count2 = 0, Count3 = 0, Count4 = 0;
|
||
int rowsCount = this.Grid1.Rows.Count;
|
||
for (int i = 0; i < rowsCount; i++)
|
||
{
|
||
int IsoInfoCount = Funs.GetNewIntOrZero(this.Grid1.Rows[i].Values[3].ToString()); //总焊口
|
||
int IsoInfoCountT = Funs.GetNewIntOrZero(this.Grid1.Rows[i].Values[4].ToString()); //完成总焊口
|
||
int CountS = Funs.GetNewIntOrZero(this.Grid1.Rows[i].Values[5].ToString()); ; //合格数
|
||
int CountU = Funs.GetNewIntOrZero(this.Grid1.Rows[i].Values[6].ToString()); ; //不合格数
|
||
decimal Rate = 0;
|
||
bool convertible = decimal.TryParse(this.Grid1.Rows[i].Values[9].ToString(), out Rate); //应检测比例
|
||
decimal Ratio = Funs.GetNewDecimalOrZero(this.Grid1.Rows[i].Values[10].ToString()); //实际检测比例
|
||
|
||
if (IsoInfoCount > IsoInfoCountT) //未焊完
|
||
{
|
||
Count1 += 1;
|
||
this.Grid1.Rows[i].RowCssClass = "Cyan";
|
||
}
|
||
else if (Rate > Ratio) //已焊完,未达检测比例
|
||
{
|
||
Count2 += 1;
|
||
this.Grid1.Rows[i].RowCssClass = "Yellow";
|
||
}
|
||
else if (CountU > 0) //已焊完,已达检测比例,但有不合格
|
||
{
|
||
Count3 += 1;
|
||
this.Grid1.Rows[i].RowCssClass = "Green";
|
||
}
|
||
else
|
||
{
|
||
Count4 += 1;
|
||
this.Grid1.Rows[i].RowCssClass = "Purple";
|
||
}
|
||
}
|
||
|
||
Count = Count1 + Count2 + Count2;
|
||
this.lab1.Text = Count1.ToString();
|
||
this.lab2.Text = Count2.ToString();
|
||
this.lab3.Text = Count3.ToString();
|
||
this.lab4.Text = Count4.ToString();
|
||
}
|
||
|
||
#region 加载页面输入保存信息
|
||
/// <summary>
|
||
/// 加载页面输入保存信息
|
||
/// </summary>
|
||
private void PageInfoLoad()
|
||
{
|
||
this.btnAudit.Hidden = true;
|
||
this.btnCancelAudit.Hidden = true;
|
||
var testPackageManage = BLL.TestPackageManageEditService.GetTestPackageByID(this.PTP_ID);
|
||
if (testPackageManage != null)
|
||
{
|
||
this.txtTestPackageNo.Text = testPackageManage.TestPackageNo;
|
||
//if (!string.IsNullOrEmpty(testPackageManage.UnitId))
|
||
//{
|
||
// var unit = BLL.Base_UnitService.GetUnit(testPackageManage.UnitId);
|
||
// if (unit != null)
|
||
// {
|
||
// this.drpUnit.Text = unit.UnitName;
|
||
// }
|
||
//}
|
||
if (!string.IsNullOrEmpty(testPackageManage.InstallationId))
|
||
{
|
||
var install = BLL.Project_InstallationService.GetProject_InstallationByInstallationId(testPackageManage.InstallationId);
|
||
if (install != null)
|
||
{
|
||
this.drpInstallation.Text = install.InstallationName;
|
||
}
|
||
}
|
||
|
||
this.txtTestPackageName.Text = testPackageManage.TestPackageName;
|
||
//this.txtTestPackageCode.Text = testPackageManage.TestPackageCode;
|
||
if (!string.IsNullOrEmpty(testPackageManage.TestType))
|
||
{
|
||
var testType = BLL.Base_PressureService.GetPressureByPressureId(testPackageManage.TestType);
|
||
if (testType != null)
|
||
{
|
||
this.drpTestType.Text = testType.PressureName;
|
||
}
|
||
}
|
||
this.txtTestService.Text = testPackageManage.TestService;
|
||
this.txtTestHeat.Text = testPackageManage.TestHeat;
|
||
this.txtTestAmbientTemp.Text = testPackageManage.TestAmbientTemp;
|
||
|
||
this.txtTestMediumTemp.Text = testPackageManage.TestMediumTemp;
|
||
this.txtVacuumTestService.Text = testPackageManage.VacuumTestService;
|
||
this.txtVacuumTestPressure.Text = testPackageManage.VacuumTestPressure;
|
||
|
||
this.txtTightnessTestTime.Text = testPackageManage.TightnessTestTime;
|
||
this.txtTightnessTestTemp.Text = testPackageManage.TightnessTestTemp;
|
||
this.txtTightnessTest.Text = testPackageManage.TightnessTest;
|
||
|
||
this.txtTestPressure.Text = testPackageManage.TestPressure;
|
||
this.txtTestPressureTemp.Text = testPackageManage.TestPressureTemp;
|
||
this.txtTestPressureTime.Text = testPackageManage.TestPressureTime;
|
||
|
||
this.txtOperationMedium.Text = testPackageManage.OperationMedium;
|
||
this.txtPurgingMedium.Text = testPackageManage.PurgingMedium;
|
||
this.txtCleaningMedium.Text = testPackageManage.CleaningMedium;
|
||
|
||
this.txtLeakageTestService.Text = testPackageManage.LeakageTestService;
|
||
this.txtLeakageTestPressure.Text = testPackageManage.LeakageTestPressure;
|
||
this.txtAllowSeepage.Text = testPackageManage.AllowSeepage;
|
||
this.txtFactSeepage.Text = testPackageManage.FactSeepage;
|
||
this.txtModifyDate.Text = string.Format("{0:yyyy-MM-dd}", testPackageManage.ModifyDate);
|
||
if (!string.IsNullOrEmpty(testPackageManage.Modifier))
|
||
{
|
||
var users = BLL.Sys_UserService.GetUsersByUserId(testPackageManage.Modifier);
|
||
if (users != null)
|
||
{
|
||
this.drpModifier.Text = users.UserName;
|
||
}
|
||
}
|
||
this.txtTableDate.Text = string.Format("{0:yyyy-MM-dd}", testPackageManage.TableDate);
|
||
if (!string.IsNullOrEmpty(testPackageManage.Tabler))
|
||
{
|
||
var users = BLL.Sys_UserService.GetUsersByUserId(testPackageManage.Tabler);
|
||
if (users != null)
|
||
{
|
||
this.drpTabler.Text = users.UserName;
|
||
}
|
||
}
|
||
this.txtRemark.Text = testPackageManage.Remark;
|
||
|
||
this.txtAuditDate.Text = string.Format("{0:yyyy-MM-dd}", testPackageManage.AduditDate);
|
||
if (!string.IsNullOrEmpty(testPackageManage.Auditer))
|
||
{
|
||
this.drpAuditMan.SelectedValue = testPackageManage.Auditer;
|
||
}
|
||
|
||
if (string.IsNullOrEmpty(testPackageManage.Auditer) || !testPackageManage.AduditDate.HasValue)
|
||
{
|
||
this.btnAudit.Hidden = false;
|
||
this.drpAuditMan.Enabled = true;
|
||
this.txtAuditDate.Enabled = true;
|
||
}
|
||
else
|
||
{
|
||
this.btnCancelAudit.Hidden = false;
|
||
this.drpAuditMan.Enabled = false;
|
||
this.txtAuditDate.Enabled = false;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 清空输入框
|
||
/// <summary>
|
||
/// 清空输入框
|
||
/// </summary>
|
||
private void SetTextTemp()
|
||
{
|
||
this.txtTestPackageNo.Text = string.Empty;
|
||
//this.drpUnit.Text = string.Empty;
|
||
this.drpInstallation.Text = string.Empty;
|
||
this.txtTestPackageName.Text = string.Empty;
|
||
//this.txtTestPackageCode.Text = string.Empty;
|
||
this.drpTestType.Text = string.Empty;
|
||
this.txtTestService.Text = string.Empty;
|
||
this.txtTestHeat.Text = string.Empty;
|
||
this.txtTestAmbientTemp.Text = string.Empty;
|
||
this.txtTestMediumTemp.Text = string.Empty;
|
||
this.txtVacuumTestService.Text = string.Empty;
|
||
this.txtVacuumTestPressure.Text = string.Empty;
|
||
this.txtTightnessTestTime.Text = string.Empty;
|
||
this.txtTightnessTestTemp.Text = string.Empty;
|
||
this.txtTightnessTest.Text = string.Empty;
|
||
this.txtTestPressure.Text = string.Empty;
|
||
this.txtTestPressureTemp.Text = string.Empty;
|
||
this.txtTestPressureTime.Text = string.Empty;
|
||
this.txtOperationMedium.Text = string.Empty;
|
||
this.txtPurgingMedium.Text = string.Empty;
|
||
this.txtCleaningMedium.Text = string.Empty;
|
||
this.txtLeakageTestService.Text = string.Empty;
|
||
this.txtLeakageTestPressure.Text = string.Empty;
|
||
this.txtAllowSeepage.Text = string.Empty;
|
||
this.txtFactSeepage.Text = string.Empty;
|
||
this.drpModifier.Text = string.Empty;
|
||
this.txtModifyDate.Text = string.Empty;
|
||
this.drpTabler.Text = string.Empty;
|
||
this.txtTableDate.Text = string.Empty;
|
||
this.txtRemark.Text = string.Empty;
|
||
this.drpAuditMan.SelectedValue = BLL.Const._Null;
|
||
this.txtAuditDate.Text = string.Empty;
|
||
}
|
||
#endregion
|
||
#endregion
|
||
|
||
#region 分页排序
|
||
#region 页索引改变事件
|
||
/// <summary>
|
||
/// 页索引改变事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 排序
|
||
/// <summary>
|
||
/// 排序
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 分页选择下拉改变事件
|
||
/// <summary>
|
||
/// 分页选择下拉改变事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
#endregion
|
||
|
||
#region 试压包 审核事件
|
||
#region 审核检测单
|
||
/// <summary>
|
||
/// 审核检测单
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnAudit_Click(object sender, EventArgs e)
|
||
{
|
||
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.TestPackageManageAuditMenuId, Const.BtnAuditing))
|
||
{
|
||
var updateTestPackage = BLL.TestPackageManageEditService.GetTestPackageByID(this.PTP_ID);
|
||
if (updateTestPackage != null)
|
||
{
|
||
if (Count == 0)
|
||
{
|
||
string isnoHot = BLL.TestPackageManageEditService.IsExistNoHotHardItem(this.PTP_ID);
|
||
if (string.IsNullOrEmpty(isnoHot))
|
||
{
|
||
string inspectionIsoRate = BLL.TestPackageManageEditService.InspectionIsoRate(this.PTP_ID);
|
||
if (string.IsNullOrEmpty(inspectionIsoRate))
|
||
{
|
||
if (!String.IsNullOrEmpty(this.txtAuditDate.Text) && this.drpAuditMan.SelectedValue != BLL.Const._Null)
|
||
{
|
||
updateTestPackage.AduditDate = Funs.GetNewDateTime(this.txtAuditDate.Text);
|
||
updateTestPackage.Auditer = this.drpAuditMan.SelectedValue;
|
||
BLL.TestPackageManageAuditService.AuditTestPackage(updateTestPackage);
|
||
this.InitTreeMenu();
|
||
this.BindGrid();
|
||
ShowNotify("审核完成!", MessageBoxIcon.Success);
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop("请填写审核人和审核日期!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop(inspectionIsoRate, MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop(isnoHot, MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop("管线未全部通过不允许审核操作!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop("请选择要审核的单据!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 取消审核检测单
|
||
/// <summary>
|
||
/// 取消审核检测单
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnCancelAudit_Click(object sender, EventArgs e)
|
||
{
|
||
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.TestPackageManageAuditMenuId, Const.BtnCancelAuditing))
|
||
{
|
||
var updateTestPackage = BLL.TestPackageManageEditService.GetTestPackageByID(this.PTP_ID);
|
||
if (updateTestPackage != null)
|
||
{
|
||
updateTestPackage.Auditer = null;
|
||
updateTestPackage.AduditDate = null;
|
||
BLL.TestPackageManageAuditService.AuditTestPackage(updateTestPackage);
|
||
this.InitTreeMenu();
|
||
this.BindGrid();
|
||
ShowNotify("取消审核完成!", MessageBoxIcon.Success);
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请确认单据!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
#endregion
|
||
#endregion
|
||
|
||
#region 关闭弹出窗口及刷新页面
|
||
/// <summary>
|
||
/// 关闭弹出窗口
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||
{
|
||
this.PTP_ID = this.hdPTP_ID.Text;
|
||
this.BindGrid();
|
||
this.InitTreeMenu();
|
||
this.hdPTP_ID.Text = string.Empty;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Tree_TextChanged(object sender, EventArgs e)
|
||
{
|
||
this.InitTreeMenu();
|
||
this.BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 试压包打印
|
||
|
||
/// <summary>
|
||
/// 试压包打印
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnPrint_Click(object sender, EventArgs e)
|
||
{
|
||
var selectValArray = this.drpPrintTypeList.SelectedValueArray;
|
||
if (selectValArray.Length <= 0)
|
||
{
|
||
Alert.ShowInTop("请选择打印报表!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
string selectValStr = string.Join(",", selectValArray).Replace("null,", "");
|
||
if (selectValStr == "null")
|
||
{
|
||
Alert.ShowInTop("请选择打印报表!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
||
{
|
||
Alert.ShowInTop("请选择试压包!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
|
||
CreateDataExcel(selectValArray);
|
||
}
|
||
|
||
#region 绘画模版
|
||
//1-TP-01-试压包路径表UG-FW-001
|
||
private void template1(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
//插入图片部分
|
||
var img1 = Server.MapPath("~/res/images/bsf/1.png");
|
||
var img2 = Server.MapPath("~/res/images/bsf/2.png");
|
||
var img3 = Server.MapPath("~/res/images/bsf/3.png");
|
||
var img4 = Server.MapPath("~/res/images/bsf/4.png");
|
||
|
||
int rowIndex = 0;
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
#region 头部
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 16, style, 0, 18, true);
|
||
ws.GetRow(rowIndex).GetCell(15).SetCellValue("Form No.");
|
||
ws.GetRow(rowIndex).GetCell(16).SetCellValue("TP-06");
|
||
//设置列宽度
|
||
ws.SetColumnWidth(0, 1 * 256);
|
||
ws.SetColumnWidth(1, 1 * 256);
|
||
ws.SetColumnWidth(2, 7 * 256);
|
||
ws.SetColumnWidth(3, 7 * 256);
|
||
ws.SetColumnWidth(4, 7 * 256);
|
||
ws.SetColumnWidth(5, 12 * 256);
|
||
ws.SetColumnWidth(6, 10 * 256);
|
||
ws.SetColumnWidth(7, 10 * 256);
|
||
ws.SetColumnWidth(8, 6 * 256);
|
||
ws.SetColumnWidth(9, 10 * 256);
|
||
ws.SetColumnWidth(10, 10 * 256);
|
||
ws.SetColumnWidth(11, 6 * 256);
|
||
ws.SetColumnWidth(12, 10 * 256);
|
||
ws.SetColumnWidth(13, 10 * 256);
|
||
ws.SetColumnWidth(14, 6 * 256);
|
||
ws.SetColumnWidth(15, 10 * 256);
|
||
ws.SetColumnWidth(16, 10 * 256);
|
||
ws.SetColumnWidth(17, 6 * 256);
|
||
ws.SetColumnWidth(18, 1 * 256);
|
||
//设置前1-5行高度
|
||
ws.GetRow(0).Height = 15 * 20;
|
||
ws.GetRow(1).Height = 15 * 20;
|
||
ws.GetRow(2).Height = 14 * 20;
|
||
ws.GetRow(3).Height = 12 * 20;
|
||
ws.GetRow(4).Height = 22 * 20;
|
||
//插入图片
|
||
InsertImage(hssfworkbook, ws, 2, 2, 2, 3, img1, 1.3, 1.1);
|
||
InsertImage(hssfworkbook, ws, 2, 4, 2, 5, img2, 1.4, 1.1);
|
||
InsertImage(hssfworkbook, ws, 2, 14, 2, 15, img3, 1.6, 1.1);
|
||
InsertImage(hssfworkbook, ws, 2, 16, 2, 17, img4, 1.6, 1.1);
|
||
|
||
ws.GetRow(rowIndex + 2).GetCell(5).SetCellValue("巴斯夫(广东)一体化项目 \r\n\t BASF(Guangdong) Integrated Project Citral Cluster");
|
||
ws.GetRow(rowIndex + 2).GetCell(5).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 16, true, true, "Times New Roman");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 5, 14));
|
||
ws.GetRow(2).Height = 55 * 20;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 8, 1, 17));
|
||
var setStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 26, true, true, "Arial");
|
||
ws.GetRow(rowIndex + 5).GetCell(1).SetCellValue("管道试压包流转路径表 \r\n Piping Test Package Routing Form");
|
||
ws.GetRow(rowIndex + 5).GetCell(1).CellStyle = setStyle;
|
||
//设置6-10 行 行高度
|
||
ws.GetRow(rowIndex + 5).Height = 25 * 20;
|
||
ws.GetRow(rowIndex + 6).Height = 13 * 20;
|
||
ws.GetRow(rowIndex + 7).Height = 27 * 20;
|
||
ws.GetRow(rowIndex + 8).Height = 22 * 20;
|
||
ws.GetRow(rowIndex + 9).Height = 15 * 20;
|
||
|
||
ws.GetRow(rowIndex + 10).Height = 32 * 20;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 10, rowIndex + 10, 1, 3));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 10, rowIndex + 10, 4, 5));
|
||
ws.GetRow(rowIndex + 11).Height = 11 * 20;
|
||
|
||
ws.GetRow(rowIndex + 10).GetCell(1).SetCellValue("试压包号\r\nTest Package No.");
|
||
ws.GetRow(rowIndex + 10).GetCell(4).SetCellValue(info?.testpackageNo);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 13, 2, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 13, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 13, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 13, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 13, 15, 16));
|
||
|
||
ws.GetRow(rowIndex + 12).GetCell(2).SetCellValue("ACTIVITY");
|
||
ws.GetRow(rowIndex + 12).GetCell(2).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None,
|
||
BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial");
|
||
ws.GetRow(rowIndex + 12).GetCell(6).SetCellValue(info?.workAreaCode);
|
||
ws.GetRow(rowIndex + 12).GetCell(6).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None,
|
||
BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial");
|
||
ws.GetRow(rowIndex + 12).GetCell(9).SetCellValue("JIANLI");
|
||
ws.GetRow(rowIndex + 12).GetCell(9).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None,
|
||
BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial");
|
||
ws.GetRow(rowIndex + 12).GetCell(12).SetCellValue("WORLEY");
|
||
ws.GetRow(rowIndex + 12).GetCell(12).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None,
|
||
BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial");
|
||
ws.GetRow(rowIndex + 12).GetCell(15).SetCellValue("BASF");
|
||
ws.GetRow(rowIndex + 12).GetCell(15).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None,
|
||
BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial");
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 15, rowIndex + 65, style, 0, 18, true);
|
||
|
||
for (int i = 15; i < 66; i++)
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 28 * 20;
|
||
}
|
||
|
||
var image1 = Server.MapPath("~/res/images/bsf/图片1.png");
|
||
var image2 = Server.MapPath("~/res/images/bsf/图片2.png");
|
||
var image3 = Server.MapPath("~/res/images/bsf/图片3.png");
|
||
var image4 = Server.MapPath("~/res/images/bsf/图片4.png");
|
||
var image5 = Server.MapPath("~/res/images/bsf/图片5.png");
|
||
var image6 = Server.MapPath("~/res/images/bsf/图片6.png");
|
||
var image7 = Server.MapPath("~/res/images/bsf/图片7.png");
|
||
var image8 = Server.MapPath("~/res/images/bsf/图片8.png");
|
||
var image9 = Server.MapPath("~/res/images/bsf/图片9.png");
|
||
var image10 = Server.MapPath("~/res/images/bsf/图片10.png");
|
||
InsertImage(hssfworkbook, ws, 15, 2, 17, 4, image1, 1.55, 1.32);
|
||
InsertImage(hssfworkbook, ws, 18, 2, 20, 4, image10, 0.02, 2.27);
|
||
|
||
InsertImage(hssfworkbook, ws, 21, 2, 23, 4, image2, 1.55, 1.12);
|
||
InsertImage(hssfworkbook, ws, 24, 2, 26, 4, image10, 0.02, 2.27);
|
||
|
||
InsertImage(hssfworkbook, ws, 27, 2, 29, 4, image3, 1.55, 1.12);
|
||
InsertImage(hssfworkbook, ws, 30, 2, 33, 4, image10, 0.02, 2.27);
|
||
|
||
InsertImage(hssfworkbook, ws, 33, 2, 35, 4, image4, 1.55, 1.12);
|
||
InsertImage(hssfworkbook, ws, 36, 2, 38, 4, image10, 0.02, 2.27);
|
||
|
||
|
||
InsertImage(hssfworkbook, ws, 39, 2, 41, 4, image5, 1.55, 1.12);
|
||
InsertImage(hssfworkbook, ws, 42, 2, 44, 4, image10, 0.02, 2.27);
|
||
|
||
InsertImage(hssfworkbook, ws, 45, 2, 47, 4, image6, 1.55, 1.12);
|
||
InsertImage(hssfworkbook, ws, 48, 2, 50, 4, image10, 0.02, 2.27);
|
||
|
||
InsertImage(hssfworkbook, ws, 51, 2, 53, 4, image7, 1.55, 1.12);
|
||
InsertImage(hssfworkbook, ws, 54, 2, 55, 4, image10, 0.02, 2.27);
|
||
|
||
InsertImage(hssfworkbook, ws, 57, 2, 59, 4, image8, 1.55, 1.12);
|
||
InsertImage(hssfworkbook, ws, 60, 2, 62, 4, image10, 0.02, 2.27);
|
||
|
||
InsertImage(hssfworkbook, ws, 63, 2, 65, 4, image9, 1.55, 1.12);
|
||
|
||
//循环数据表格部分
|
||
ws.GetRow(rowIndex + 15).Height = 30 * 20;
|
||
ws.GetRow(rowIndex + 16).Height = 30 * 20;
|
||
ws.GetRow(rowIndex + 17).Height = 30 * 20;
|
||
|
||
#region 第一层签名
|
||
ws.GetRow(rowIndex + 15).GetCell(5).SetCellValue("姓名\r\nNAME");
|
||
ws.GetRow(rowIndex + 16).GetCell(5).SetCellValue("签名\r\nSIGNATURE");
|
||
ws.GetRow(rowIndex + 17).GetCell(5).SetCellValue("日期\r\nDATE");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 15, 16), ws);
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 16, rowIndex + 16, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 16, rowIndex + 16, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 16, rowIndex + 16, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 16, rowIndex + 16, 15, 16), ws);
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 17, rowIndex + 17, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 17, rowIndex + 17, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 17, rowIndex + 17, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 17, rowIndex + 17, 15, 16), ws);
|
||
#endregion
|
||
|
||
#region 第二层签名
|
||
ws.GetRow(rowIndex + 21).GetCell(5).SetCellValue("姓名\r\nNAME");
|
||
ws.GetRow(rowIndex + 22).GetCell(5).SetCellValue("签名\r\nSIGNATURE");
|
||
ws.GetRow(rowIndex + 23).GetCell(5).SetCellValue("日期\r\nDATE");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 21, rowIndex + 21, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 21, rowIndex + 21, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 21, rowIndex + 21, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 21, rowIndex + 21, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 21, rowIndex + 21, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 21, rowIndex + 21, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 21, rowIndex + 21, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 21, rowIndex + 21, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 22, rowIndex + 22, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 22, rowIndex + 22, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 22, rowIndex + 22, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 22, rowIndex + 22, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 22, rowIndex + 22, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 22, rowIndex + 22, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 22, rowIndex + 22, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 22, rowIndex + 22, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 15, 16), ws);
|
||
#endregion
|
||
|
||
#region 第三层签名
|
||
ws.GetRow(rowIndex + 27).GetCell(5).SetCellValue("姓名\r\nNAME");
|
||
ws.GetRow(rowIndex + 28).GetCell(5).SetCellValue("签名\r\nSIGNATURE");
|
||
ws.GetRow(rowIndex + 29).GetCell(5).SetCellValue("日期\r\nDATE");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 27, rowIndex + 27, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 27, rowIndex + 27, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 27, rowIndex + 27, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 27, rowIndex + 27, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 27, rowIndex + 27, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 27, rowIndex + 27, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 27, rowIndex + 27, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 27, rowIndex + 27, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 28, rowIndex + 28, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 28, rowIndex + 28, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 28, rowIndex + 28, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 28, rowIndex + 28, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 28, rowIndex + 28, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 28, rowIndex + 28, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 28, rowIndex + 28, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 28, rowIndex + 28, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 29, rowIndex + 29, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 29, rowIndex + 29, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 29, rowIndex + 29, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 29, rowIndex + 29, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 29, rowIndex + 29, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 29, rowIndex + 29, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 29, rowIndex + 29, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 29, rowIndex + 29, 15, 16), ws);
|
||
#endregion
|
||
|
||
#region 第四层签名
|
||
ws.GetRow(rowIndex + 33).GetCell(5).SetCellValue("姓名\r\nNAME");
|
||
ws.GetRow(rowIndex + 34).GetCell(5).SetCellValue("签名\r\nSIGNATURE");
|
||
ws.GetRow(rowIndex + 35).GetCell(5).SetCellValue("日期\r\nDATE");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 33, rowIndex + 33, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 33, rowIndex + 33, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 33, rowIndex + 33, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 33, rowIndex + 33, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 33, rowIndex + 33, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 33, rowIndex + 33, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 33, rowIndex + 33, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 33, rowIndex + 33, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 34, rowIndex + 34, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 34, rowIndex + 34, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 34, rowIndex + 34, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 34, rowIndex + 34, 15, 16));
|
||
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 34, rowIndex + 34, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 34, rowIndex + 34, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 34, rowIndex + 34, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 34, rowIndex + 34, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 35, rowIndex + 35, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 35, rowIndex + 35, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 35, rowIndex + 35, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 35, rowIndex + 35, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 35, rowIndex + 35, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 35, rowIndex + 35, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 35, rowIndex + 35, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 35, rowIndex + 35, 15, 16), ws);
|
||
#endregion
|
||
|
||
#region 第五层签名
|
||
ws.GetRow(rowIndex + 39).GetCell(5).SetCellValue("姓名\r\nNAME");
|
||
ws.GetRow(rowIndex + 40).GetCell(5).SetCellValue("签名\r\nSIGNATURE");
|
||
ws.GetRow(rowIndex + 41).GetCell(5).SetCellValue("日期\r\nDATE");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 39, rowIndex + 39, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 39, rowIndex + 39, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 39, rowIndex + 39, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 39, rowIndex + 39, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 39, rowIndex + 39, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 39, rowIndex + 39, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 39, rowIndex + 39, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 39, rowIndex + 39, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 40, rowIndex + 40, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 40, rowIndex + 40, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 40, rowIndex + 40, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 40, rowIndex + 40, 15, 16));
|
||
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 40, rowIndex + 40, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 40, rowIndex + 40, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 40, rowIndex + 40, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 40, rowIndex + 40, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 41, rowIndex + 41, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 41, rowIndex + 41, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 41, rowIndex + 41, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 41, rowIndex + 41, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 41, rowIndex + 41, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 41, rowIndex + 41, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 41, rowIndex + 41, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 41, rowIndex + 41, 15, 16), ws);
|
||
#endregion
|
||
|
||
#region 第六层签名
|
||
ws.GetRow(rowIndex + 45).GetCell(5).SetCellValue("姓名\r\nNAME");
|
||
ws.GetRow(rowIndex + 46).GetCell(5).SetCellValue("签名\r\nSIGNATURE");
|
||
ws.GetRow(rowIndex + 47).GetCell(5).SetCellValue("日期\r\nDATE");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 45, rowIndex + 45, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 45, rowIndex + 45, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 45, rowIndex + 45, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 45, rowIndex + 45, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 45, rowIndex + 45, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 45, rowIndex + 45, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 45, rowIndex + 45, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 45, rowIndex + 45, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 46, rowIndex + 46, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 46, rowIndex + 46, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 46, rowIndex + 46, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 46, rowIndex + 46, 15, 16));
|
||
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 46, rowIndex + 46, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 46, rowIndex + 46, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 46, rowIndex + 46, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 46, rowIndex + 46, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 47, rowIndex + 47, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 47, rowIndex + 47, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 47, rowIndex + 47, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 47, rowIndex + 47, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 47, rowIndex + 47, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 47, rowIndex + 47, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 47, rowIndex + 47, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 47, rowIndex + 47, 15, 16), ws);
|
||
#endregion
|
||
|
||
#region 第七层签名
|
||
ws.GetRow(rowIndex + 51).GetCell(5).SetCellValue("姓名\r\nNAME");
|
||
ws.GetRow(rowIndex + 52).GetCell(5).SetCellValue("签名\r\nSIGNATURE");
|
||
ws.GetRow(rowIndex + 53).GetCell(5).SetCellValue("日期\r\nDATE");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 51, rowIndex + 51, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 51, rowIndex + 51, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 51, rowIndex + 51, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 51, rowIndex + 51, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 51, rowIndex + 51, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 51, rowIndex + 51, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 51, rowIndex + 51, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 51, rowIndex + 51, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 52, rowIndex + 52, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 52, rowIndex + 52, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 52, rowIndex + 52, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 52, rowIndex + 52, 15, 16));
|
||
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 52, rowIndex + 52, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 52, rowIndex + 52, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 52, rowIndex + 52, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 52, rowIndex + 52, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 53, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 53, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 53, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 53, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 53, rowIndex + 53, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 53, rowIndex + 53, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 53, rowIndex + 53, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 53, rowIndex + 53, 15, 16), ws);
|
||
#endregion
|
||
|
||
#region 第八层签名
|
||
ws.GetRow(rowIndex + 57).GetCell(5).SetCellValue("姓名\r\nNAME");
|
||
ws.GetRow(rowIndex + 58).GetCell(5).SetCellValue("签名\r\nSIGNATURE");
|
||
ws.GetRow(rowIndex + 59).GetCell(5).SetCellValue("日期\r\nDATE");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 57, rowIndex + 57, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 57, rowIndex + 57, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 57, rowIndex + 57, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 57, rowIndex + 57, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 57, rowIndex + 57, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 57, rowIndex + 57, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 57, rowIndex + 57, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 57, rowIndex + 57, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 58, rowIndex + 58, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 58, rowIndex + 58, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 58, rowIndex + 58, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 58, rowIndex + 58, 15, 16));
|
||
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 58, rowIndex + 58, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 58, rowIndex + 58, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 58, rowIndex + 58, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 58, rowIndex + 58, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 59, rowIndex + 59, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 59, rowIndex + 59, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 59, rowIndex + 59, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 59, rowIndex + 59, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 59, rowIndex + 59, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 59, rowIndex + 59, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 59, rowIndex + 59, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 59, rowIndex + 59, 15, 16), ws);
|
||
#endregion
|
||
|
||
#region 第九层签名
|
||
ws.GetRow(rowIndex + 63).GetCell(5).SetCellValue("姓名\r\nNAME");
|
||
ws.GetRow(rowIndex + 64).GetCell(5).SetCellValue("签名\r\nSIGNATURE");
|
||
ws.GetRow(rowIndex + 65).GetCell(5).SetCellValue("日期\r\nDATE");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 63, rowIndex + 63, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 63, rowIndex + 63, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 63, rowIndex + 63, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 63, rowIndex + 63, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 63, rowIndex + 63, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 63, rowIndex + 63, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 63, rowIndex + 63, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 63, rowIndex + 63, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 64, rowIndex + 64, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 64, rowIndex + 64, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 64, rowIndex + 64, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 64, rowIndex + 64, 15, 16));
|
||
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 64, rowIndex + 64, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 64, rowIndex + 64, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 64, rowIndex + 64, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 64, rowIndex + 64, 15, 16), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 65, rowIndex + 65, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 65, rowIndex + 65, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 65, rowIndex + 65, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 65, rowIndex + 65, 15, 16));
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 65, rowIndex + 65, 6, 7), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 65, rowIndex + 65, 9, 10), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 65, rowIndex + 65, 12, 13), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 65, rowIndex + 65, 15, 16), ws);
|
||
#endregion
|
||
|
||
|
||
#endregion
|
||
|
||
#region 边框设置
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(1, 1, 1, 17), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(65, 65, 1, 17), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(2, 65, 0, 0), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(2, 65, 17, 17), ws);
|
||
|
||
#endregion
|
||
|
||
ws.PrintSetup.FitWidth = 1;
|
||
ws.PrintSetup.FitHeight = 0;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
|
||
ws.FitToPage = true;
|
||
|
||
//垂直水平居中
|
||
ws.VerticallyCenter = true;
|
||
ws.HorizontallyCenter = true;
|
||
//页眉页脚间距
|
||
ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
ws.SetMargin(MarginType.FooterMargin, 0);
|
||
}
|
||
|
||
//6-TP-05-P&ID清单UG-FW-001 模版
|
||
private void template6(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
//插入图片部分
|
||
var img1 = Server.MapPath("~/res/images/bsf/1.png");
|
||
var img2 = Server.MapPath("~/res/images/bsf/2.png");
|
||
var img3 = Server.MapPath("~/res/images/bsf/3.png");
|
||
var img4 = Server.MapPath("~/res/images/bsf/4.png");
|
||
|
||
int rowIndex = 0;
|
||
|
||
//查询数据
|
||
string sql = @"select * from (
|
||
select
|
||
a.PTP_ID,
|
||
a.TestPackageNo,
|
||
d.WorkAreaId,
|
||
d.WorkAreaCode,
|
||
c.PipelineId,
|
||
c.PipelineCode,
|
||
c.SystemNumber,
|
||
a.TestHeat,
|
||
a.TestType,
|
||
c.SingleNumber,
|
||
c.DrawingsNum,
|
||
a.Remark,
|
||
(select top 1 PageNum from Pipeline_WeldJoint where PipelineId=b.PipelineId order by WeldJointCode) as PageNum
|
||
from PTP_TestPackage as a
|
||
inner join
|
||
PTP_PipelineList as b on a.PTP_ID=b.PTP_ID
|
||
left join
|
||
Pipeline_Pipeline as c on b.PipelineId=c.PipelineId
|
||
left join Project_WorkArea as d on b.WorkAreaId=d.WorkAreaId
|
||
) as t where PTP_ID=@PTP_ID ";
|
||
|
||
SqlParameter[] parms = new SqlParameter[]{
|
||
new SqlParameter("@PTP_ID",this.tvControlItem.SelectedNodeID)
|
||
};
|
||
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
//获取试压包第一行记录
|
||
|
||
#region 分页数据
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 37 ? 1
|
||
: Math.Ceiling((float)(tbNum - 37) / 37) + 1;
|
||
|
||
for (int i = 1; i <= pageNum; i++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex, rowIndex, style, 0, 17, 13);
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex + 1, rowIndex + 1, style, 0, 17, 4);
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex + 2, rowIndex + 15, style, 0, 17, 13);
|
||
ws.GetRow(rowIndex).GetCell(15).SetCellValue("Form No.");
|
||
ws.GetRow(rowIndex).GetCell(16).SetCellValue("TP-06");
|
||
|
||
#region 设置样式
|
||
//设置列宽度
|
||
ws.SetColumnWidth(0, 1 * 256);
|
||
ws.SetColumnWidth(1, 2 * 256);
|
||
ws.SetColumnWidth(2, 9 * 256);
|
||
ws.SetColumnWidth(3, 4 * 256);
|
||
ws.SetColumnWidth(4, 4 * 256);
|
||
ws.SetColumnWidth(5, 4 * 256);
|
||
ws.SetColumnWidth(6, 5 * 256);
|
||
ws.SetColumnWidth(7, 4 * 256);
|
||
ws.SetColumnWidth(8, 4 * 256);
|
||
ws.SetColumnWidth(9, 4 * 256);
|
||
ws.SetColumnWidth(10, 4 * 256);
|
||
ws.SetColumnWidth(11, 4 * 256);
|
||
ws.SetColumnWidth(12, 4 * 256);
|
||
ws.SetColumnWidth(13, 4 * 256);
|
||
ws.SetColumnWidth(14, 8 * 256);
|
||
ws.SetColumnWidth(15, 9 * 256);
|
||
ws.SetColumnWidth(16, 9 * 256);
|
||
ws.SetColumnWidth(17, 2 * 256);
|
||
//设置前3行高度
|
||
//ws.GetRow(rowIndex + 0).Height = 15 * 20;
|
||
//ws.GetRow(rowIndex + 1).Height = 15 * 20;
|
||
//ws.GetRow(rowIndex + 2).Height = 14 * 20;
|
||
//ws.GetRow(rowIndex + 3).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 4).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 5).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 6).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 7).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 8).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 9).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 10).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 11).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 12).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 13).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 14).Height = 18 * 20;
|
||
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 0, rowIndex + 0, 1, 1), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 17), ws);
|
||
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 16, 16), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 17), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 2, 16), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 2, rowIndex + 2, 2, 16), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 1, rowIndex + 14, 0, 0), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 1, 1), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 16, 16), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 17, 17), ws);
|
||
|
||
|
||
RegionUtil.SetBorderLeft(2, new CellRangeAddress(rowIndex + 9, rowIndex + 14, 2, 2), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 7, rowIndex + 7, 2, 16), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 8, rowIndex + 8, 2, 16), ws);
|
||
#endregion
|
||
|
||
#region 插入图片
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 2, rowIndex + 4, 3, img1, 1.2, 1.8);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 3, rowIndex + 4, 4, img2, 10, 2, 30, 2);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 14, rowIndex + 4, 14, img3, 1.5, 2, 8, 2);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 15, rowIndex + 4, 15, img4, 3, 2, 35, 2);
|
||
#endregion
|
||
|
||
#region 试压包头部分
|
||
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("巴斯夫(广东)一体化项目");
|
||
var setStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
ws.GetRow(rowIndex + 3).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 13));
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("BASF (GUANGDONG) INTEGRATED PROJECT");
|
||
ws.GetRow(rowIndex + 4).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 5, 13));
|
||
ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue("试压包流程图清单");
|
||
ws.GetRow(rowIndex + 5).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 13));
|
||
ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue("TEST PACKAGE P&ID DRAWING LIST");
|
||
ws.GetRow(rowIndex + 6).GetCell(5).CellStyle = setStyle;
|
||
|
||
var cellStyle2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 11, false, false, "Arial Unicode MS");
|
||
ws.GetRow(rowIndex + 9).GetCell(2).SetCellValue("Test Package No");
|
||
ws.GetRow(rowIndex + 9).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 9).GetCell(5).SetCellValue(info?.testpackageNo);
|
||
ws.GetRow(rowIndex + 9).GetCell(5).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 9).GetCell(9).SetCellValue("Area");
|
||
ws.GetRow(rowIndex + 9).GetCell(9).CellStyle = cellStyle2;
|
||
ws.GetRow(rowIndex + 9).GetCell(13).SetCellValue(info?.workAreaCode);
|
||
|
||
ws.GetRow(rowIndex + 10).GetCell(2).SetCellValue("试压包号");
|
||
ws.GetRow(rowIndex + 10).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 10).GetCell(9).SetCellValue("区域");
|
||
ws.GetRow(rowIndex + 10).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(2).SetCellValue("System No");
|
||
ws.GetRow(rowIndex + 11).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(5).SetCellValue(info?.SystemNo);
|
||
ws.GetRow(rowIndex + 11).GetCell(5).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(9).SetCellValue("Test Pressure");
|
||
ws.GetRow(rowIndex + 11).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(13).SetCellValue(info?.TestPressure);
|
||
ws.GetRow(rowIndex + 11).GetCell(13).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 12).GetCell(2).SetCellValue("系统号");
|
||
ws.GetRow(rowIndex + 12).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 12).GetCell(9).SetCellValue("试验压力");
|
||
ws.GetRow(rowIndex + 12).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 13).GetCell(9).SetCellValue("Test Type");
|
||
ws.GetRow(rowIndex + 13).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 13).GetCell(13).SetCellValue(info?.TestType);
|
||
ws.GetRow(rowIndex + 13).GetCell(13).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 14).GetCell(9).SetCellValue("试验方式");
|
||
ws.GetRow(rowIndex + 14).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 9, rowIndex + 14, 8, 8), ws);
|
||
#endregion
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
//数据表头部分
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 13));
|
||
ws.GetRow(rowIndex + 15).GetCell(0).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None);
|
||
ws.GetRow(rowIndex + 15).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
ws.GetRow(rowIndex + 15).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 3, 8));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 9, 13));
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 2, 16), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 2, 16), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 2, 2), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 8, 8), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 13, 13), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 14, 14), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 15, 15), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 16, 16), ws);
|
||
ws.GetRow(rowIndex + 15).GetCell(2).SetCellValue("No\r\n序号");
|
||
ws.GetRow(rowIndex + 15).GetCell(3).SetCellValue("P&ID Drawing No.\r\n流程图号");
|
||
ws.GetRow(rowIndex + 15).GetCell(9).SetCellValue("Drawing Description\r\n图纸名称");
|
||
ws.GetRow(rowIndex + 15).GetCell(14).SetCellValue("Rev\r\n版本");
|
||
ws.GetRow(rowIndex + 15).GetCell(15).SetCellValue("Sheet No.\r\n页码");
|
||
ws.GetRow(rowIndex + 15).GetCell(16).SetCellValue("Remark\r\n备注");
|
||
ws.GetRow(rowIndex + 15).Height = 40 * 20;
|
||
|
||
style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 11, false, false, "Arial Unicode MS");
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex + 16, rowIndex + 52, style, 0, 17, 13);
|
||
|
||
var dataTit = rowIndex + 16;
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (i == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 37;
|
||
}
|
||
else
|
||
{
|
||
dStart = i == 2 ? 37 : ((i - 2) * 37) + 37;
|
||
dEnd = ((i - 1) * 37) + 37;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int nextRow = 0;
|
||
int lastRow = 0;
|
||
int j = 0;
|
||
|
||
for (int k = 0; k < 37; k++)
|
||
{
|
||
int dataIndex = dataTit + j;
|
||
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
DataRow dr = pageTb.Rows[j];
|
||
ws.GetRow(dataIndex).GetCell(2).SetCellValue($"{j + 1}");
|
||
ws.GetRow(dataIndex).GetCell(3).SetCellValue("");
|
||
ws.GetRow(dataIndex).GetCell(9).SetCellValue("");
|
||
ws.GetRow(dataIndex).GetCell(14).SetCellValue(dr["DrawingsNum"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(15).SetCellValue(dr["PageNum"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(16).SetCellValue(dr["Remark"].ToString());
|
||
ws.GetRow(dataIndex).Height = 14 * 20;
|
||
}
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + dataIndex, rowIndex + dataIndex, 3, 8));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + dataIndex, rowIndex + dataIndex, 9, 13));
|
||
ws.GetRow(dataIndex).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
ws.GetRow(dataIndex).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
RegionUtil.SetBorderLeft(1, new CellRangeAddress(dataIndex, dataIndex, 2, 16), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 2, 2), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 8, 8), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 13, 13), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 14, 14), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 15, 15), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 16, 16), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(dataIndex, dataIndex, 2, 16), ws);
|
||
nextRow = dataIndex;
|
||
j++;
|
||
|
||
}
|
||
|
||
#region 注释
|
||
//foreach (DataRow dr in pageTb.Rows)
|
||
//{
|
||
// int dataIndex = dataTit + j;
|
||
// ws.GetRow(dataIndex).GetCell(2).SetCellValue($"{j + 1}");
|
||
// ws.GetRow(dataIndex).GetCell(3).SetCellValue("");
|
||
// ws.GetRow(dataIndex).GetCell(9).SetCellValue("");
|
||
// ws.GetRow(dataIndex).GetCell(14).SetCellValue(dr["DrawingsNum"].ToString());
|
||
// ws.GetRow(dataIndex).GetCell(15).SetCellValue(dr["PageNum"].ToString());
|
||
// ws.GetRow(dataIndex).GetCell(16).SetCellValue(dr["Remark"].ToString());
|
||
// ws.GetRow(dataIndex).Height = 14 * 20;
|
||
// ws.AddMergedRegion(new CellRangeAddress(rowIndex + dataIndex, rowIndex + dataIndex, 3, 8));
|
||
// ws.AddMergedRegion(new CellRangeAddress(rowIndex + dataIndex, rowIndex + dataIndex, 9, 13));
|
||
// ws.GetRow(dataIndex).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
// ws.GetRow(dataIndex).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
// RegionUtil.SetBorderLeft(1, new CellRangeAddress(dataIndex, dataIndex, 2, 16), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 2, 2), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 8, 8), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 13, 13), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 14, 14), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 15, 15), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 16, 16), ws);
|
||
// RegionUtil.SetBorderBottom(1, new CellRangeAddress(dataIndex, dataIndex, 2, 16), ws);
|
||
// nextRow = dataIndex;
|
||
// j++;
|
||
//}
|
||
////如果pageData不满足33行数据的情况下,将设置剩余行高
|
||
//if (pageTb.Rows.Count < 34)
|
||
//{
|
||
// for (int k = 1; k <= 34 - pageTb.Rows.Count; k++)
|
||
// {
|
||
// int dataIndex = rowIndex + nextRow + k;
|
||
// ws.GetRow(dataIndex).Height = 14 * 20;
|
||
// ws.GetRow(dataIndex).GetCell(0).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None);
|
||
// ws.GetRow(dataIndex).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
// ws.GetRow(dataIndex).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
// ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 3, 8));
|
||
// ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 9, 13));
|
||
// RegionUtil.SetBorderLeft(1, new CellRangeAddress(dataIndex, dataIndex, 2, 16), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 2, 2), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 8, 8), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 13, 13), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 14, 14), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 15, 15), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 16, 16), ws);
|
||
// RegionUtil.SetBorderBottom(1, new CellRangeAddress(dataIndex, dataIndex, 2, 16), ws);
|
||
// lastRow = nextRow + k;
|
||
// }
|
||
//}
|
||
#endregion
|
||
|
||
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + lastRow, rowIndex + lastRow, 2, 16), ws);
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex + 53, rowIndex + 58, style, 0, 17, 13);
|
||
//ws.GetRow(rowIndex + 50).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 51).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 52).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 53).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 54).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 55).Height = 4 * 20;
|
||
RegionUtil.SetBorderLeft(2, new CellRangeAddress(rowIndex + 53, rowIndex + 58, 1, 1), ws);
|
||
RegionUtil.SetBorderLeft(2, new CellRangeAddress(rowIndex + 53, rowIndex + 58, 17, 17), ws);
|
||
|
||
RegionUtil.SetBorderLeft(2, new CellRangeAddress(rowIndex + 53, rowIndex + 57, 2, 2), ws);
|
||
RegionUtil.SetBorderLeft(2, new CellRangeAddress(rowIndex + 53, rowIndex + 57, 17, 17), ws);
|
||
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 55, rowIndex + 55, 2, 16), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 53, rowIndex + 55, 4, 4), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 53, rowIndex + 55, 6, 6), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 53, rowIndex + 55, 9, 9), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 53, rowIndex + 55, 13, 13), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 56, rowIndex + 56, 4, 4), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 56, rowIndex + 56, 4, 4), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 56, rowIndex + 56, 6, 6), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 56, rowIndex + 56, 9, 9), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 56, rowIndex + 56, 13, 13), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 56, rowIndex + 57, 2, 16), ws);
|
||
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 57, rowIndex + 57, 2, 6), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 57, rowIndex + 57, 6, 6), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 57, rowIndex + 57, 9, 9), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 57, rowIndex + 57, 13, 13), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 53, rowIndex + 58, 17, 17), ws);
|
||
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 58, rowIndex + 58, 1, 17), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 2, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 5, 6));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 7, 9));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 10, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 14, 16));
|
||
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 56, 2, 4));
|
||
ws.GetRow(rowIndex + 56).GetCell(2).SetCellValue("PREPARED");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 56, 5, 6));
|
||
ws.GetRow(rowIndex + 56).GetCell(5).SetCellValue("REVIEW");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 57, 7, 9));
|
||
ws.GetRow(rowIndex + 56).GetCell(7).SetCellValue("JIANLI");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 57, 10, 13));
|
||
ws.GetRow(rowIndex + 56).GetCell(10).SetCellValue("Worley");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 57, 14, 16));
|
||
ws.GetRow(rowIndex + 56).GetCell(14).SetCellValue("BASF");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 57, rowIndex + 57, 2, 6));
|
||
ws.GetRow(rowIndex + 57).GetCell(2).SetCellValue("CC7");
|
||
|
||
|
||
#endregion
|
||
|
||
rowIndex = rowIndex + 59;
|
||
}
|
||
#endregion
|
||
|
||
ws.PrintSetup.Landscape = false;
|
||
ws.ForceFormulaRecalculation = true;
|
||
|
||
|
||
//ws.PrintSetup.FitWidth = 1;
|
||
//ws.PrintSetup.FitHeight = 0;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//ws.PrintSetup.Scale = 85;
|
||
//ws.FitToPage = true;
|
||
//垂直水平居中
|
||
//ws.VerticallyCenter = true;
|
||
//ws.HorizontallyCenter = true;
|
||
|
||
|
||
////打印边距设置
|
||
//ws.SetMargin(MarginType.RightMargin, 0);
|
||
//ws.SetMargin(MarginType.LeftMargin, 0);
|
||
//ws.SetMargin(MarginType.TopMargin, 0);
|
||
//ws.SetMargin(MarginType.BottomMargin, 0);
|
||
|
||
////页眉页脚间距
|
||
//ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
//ws.SetMargin(MarginType.FooterMargin, 0);
|
||
}
|
||
|
||
//8-TP-06-单线图清单UG-FW-001 模版
|
||
private void template8(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
//插入图片部分
|
||
var img1 = Server.MapPath("~/res/images/bsf/1.png");
|
||
var img2 = Server.MapPath("~/res/images/bsf/2.png");
|
||
var img3 = Server.MapPath("~/res/images/bsf/3.png");
|
||
var img4 = Server.MapPath("~/res/images/bsf/4.png");
|
||
|
||
int rowIndex = 0;
|
||
|
||
//查询数据
|
||
string sql = @"select * from (
|
||
select
|
||
a.PTP_ID,
|
||
a.TestPackageNo,
|
||
d.WorkAreaId,
|
||
d.WorkAreaCode,
|
||
c.PipelineId,
|
||
c.PipelineCode,
|
||
c.SystemNumber,
|
||
a.TestHeat,
|
||
a.TestType,
|
||
c.SingleNumber,
|
||
c.DrawingsNum,
|
||
a.Remark,
|
||
(select top 1 PageNum from Pipeline_WeldJoint where PipelineId=b.PipelineId order by WeldJointCode) as PageNum
|
||
from PTP_TestPackage as a
|
||
inner join
|
||
PTP_PipelineList as b on a.PTP_ID=b.PTP_ID
|
||
left join
|
||
Pipeline_Pipeline as c on b.PipelineId=c.PipelineId
|
||
left join Project_WorkArea as d on b.WorkAreaId=d.WorkAreaId
|
||
) as t where PTP_ID=@PTP_ID ";
|
||
|
||
SqlParameter[] parms = new SqlParameter[]{
|
||
new SqlParameter("@PTP_ID",this.tvControlItem.SelectedNodeID)
|
||
};
|
||
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
//获取试压包第一行记录
|
||
|
||
#region 分页数据
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 37 ? 1
|
||
: Math.Ceiling((float)(tbNum - 37) / 37) + 1;
|
||
|
||
for (int i = 1; i <= pageNum; i++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex, rowIndex, style, 0, 17, 13);
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex + 1, rowIndex + 1, style, 0, 17, 4);
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex + 2, rowIndex + 15, style, 0, 17, 13);
|
||
ws.GetRow(rowIndex).GetCell(15).SetCellValue("Form No.");
|
||
ws.GetRow(rowIndex).GetCell(16).SetCellValue("TP-06");
|
||
|
||
#region 设置样式
|
||
|
||
//设置列宽度
|
||
ws.SetColumnWidth(0, 1 * 256);
|
||
ws.SetColumnWidth(1, 2 * 256);
|
||
ws.SetColumnWidth(2, 9 * 256);
|
||
ws.SetColumnWidth(3, 4 * 256);
|
||
ws.SetColumnWidth(4, 4 * 256);
|
||
ws.SetColumnWidth(5, 4 * 256);
|
||
ws.SetColumnWidth(6, 5 * 256);
|
||
ws.SetColumnWidth(7, 4 * 256);
|
||
ws.SetColumnWidth(8, 4 * 256);
|
||
ws.SetColumnWidth(9, 4 * 256);
|
||
ws.SetColumnWidth(10, 4 * 256);
|
||
ws.SetColumnWidth(11, 4 * 256);
|
||
ws.SetColumnWidth(12, 4 * 256);
|
||
ws.SetColumnWidth(13, 4 * 256);
|
||
ws.SetColumnWidth(14, 8 * 256);
|
||
ws.SetColumnWidth(15, 9 * 256);
|
||
ws.SetColumnWidth(16, 9 * 256);
|
||
ws.SetColumnWidth(17, 2 * 256);
|
||
|
||
////设置列宽度
|
||
//ws.SetColumnWidth(0, 3 * 256);
|
||
//ws.SetColumnWidth(1, 1 * 256);
|
||
//ws.SetColumnWidth(2, 8 * 256);
|
||
//ws.SetColumnWidth(3, 5 * 256);
|
||
//ws.SetColumnWidth(4, 5 * 256);
|
||
//ws.SetColumnWidth(5, 8 * 256);
|
||
//ws.SetColumnWidth(6, 8 * 256);
|
||
//ws.SetColumnWidth(7, 4 * 256);
|
||
//ws.SetColumnWidth(8, 8 * 256);
|
||
//ws.SetColumnWidth(9, 8 * 256);
|
||
//ws.SetColumnWidth(10, 8 * 256);
|
||
//ws.SetColumnWidth(11, 8 * 256);
|
||
//ws.SetColumnWidth(12, 1 * 256);
|
||
//ws.SetColumnWidth(13, 9 * 256);
|
||
//ws.SetColumnWidth(14, 10 * 256);
|
||
//ws.SetColumnWidth(15, 10 * 256);
|
||
//ws.SetColumnWidth(16, 10 * 256);
|
||
//ws.SetColumnWidth(17, 1 * 256);
|
||
////设置前3行高度
|
||
//ws.GetRow(rowIndex + 0).Height = 15 * 20;
|
||
//ws.GetRow(rowIndex + 1).Height = 4 * 20;
|
||
//ws.GetRow(rowIndex + 2).Height = 14 * 20;
|
||
//ws.GetRow(rowIndex + 3).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 4).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 5).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 6).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 7).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 8).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 9).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 10).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 11).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 12).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 13).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 14).Height = 18 * 20;
|
||
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 0, rowIndex + 0, 1, 1), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 17), ws);
|
||
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 16, 16), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 17), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 2, 16), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 2, rowIndex + 2, 2, 16), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 1, rowIndex + 14, 0, 0), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 1, 1), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 16, 16), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 17, 17), ws);
|
||
|
||
|
||
RegionUtil.SetBorderLeft(2, new CellRangeAddress(rowIndex + 9, rowIndex + 14, 2, 2), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 7, rowIndex + 7, 2, 16), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 8, rowIndex + 8, 2, 16), ws);
|
||
#endregion
|
||
|
||
#region 插入图片
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 2, rowIndex + 4, 3, img1, 1.2, 1.8);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 3, rowIndex + 4, 4, img2, 10, 2, 30, 2);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 14, rowIndex + 4, 14, img3, 1.5, 2, 8, 2);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 15, rowIndex + 4, 15, img4, 3, 2, 35, 2);
|
||
#endregion
|
||
|
||
#region 试压包头部分
|
||
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("巴斯夫(广东)一体化项目");
|
||
var setStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
ws.GetRow(rowIndex + 3).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 13));
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("BASF (GUANGDONG) INTEGRATED PROJECT");
|
||
ws.GetRow(rowIndex + 4).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 5, 13));
|
||
ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue("试压包单线图清单");
|
||
ws.GetRow(rowIndex + 5).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 13));
|
||
ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue("TEST PACKAGE ISOMETRIC LIST");
|
||
ws.GetRow(rowIndex + 6).GetCell(5).CellStyle = setStyle;
|
||
|
||
var cellStyle2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 11, false, false, "Arial Unicode MS");
|
||
ws.GetRow(rowIndex + 9).GetCell(2).SetCellValue("Test Package No");
|
||
ws.GetRow(rowIndex + 9).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 9).GetCell(5).SetCellValue(info?.testpackageNo);
|
||
ws.GetRow(rowIndex + 9).GetCell(5).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 9).GetCell(9).SetCellValue("Area");
|
||
ws.GetRow(rowIndex + 9).GetCell(9).CellStyle = cellStyle2;
|
||
ws.GetRow(rowIndex + 9).GetCell(13).SetCellValue(info?.workAreaCode);
|
||
|
||
ws.GetRow(rowIndex + 10).GetCell(2).SetCellValue("试压包号");
|
||
ws.GetRow(rowIndex + 10).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 10).GetCell(9).SetCellValue("区域");
|
||
ws.GetRow(rowIndex + 10).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(2).SetCellValue("System No");
|
||
ws.GetRow(rowIndex + 11).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(5).SetCellValue(info?.SystemNo);
|
||
ws.GetRow(rowIndex + 11).GetCell(5).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(9).SetCellValue("Test Pressure");
|
||
ws.GetRow(rowIndex + 11).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(13).SetCellValue(info?.TestPressure);
|
||
ws.GetRow(rowIndex + 11).GetCell(13).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 12).GetCell(2).SetCellValue("系统号");
|
||
ws.GetRow(rowIndex + 12).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 12).GetCell(9).SetCellValue("试验压力");
|
||
ws.GetRow(rowIndex + 12).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 13).GetCell(9).SetCellValue("Test Type");
|
||
ws.GetRow(rowIndex + 13).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 13).GetCell(13).SetCellValue(info?.TestType);
|
||
ws.GetRow(rowIndex + 13).GetCell(13).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 14).GetCell(9).SetCellValue("试验方式");
|
||
ws.GetRow(rowIndex + 14).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 9, rowIndex + 14, 8, 8), ws);
|
||
#endregion
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
//数据表头部分
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 13));
|
||
ws.GetRow(rowIndex + 15).GetCell(0).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None);
|
||
ws.GetRow(rowIndex + 15).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
ws.GetRow(rowIndex + 15).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 3, 8));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 9, 13));
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 2, 16), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 2, 16), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 2, 2), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 8, 8), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 13, 13), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 14, 14), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 15, 15), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 16, 16), ws);
|
||
ws.GetRow(rowIndex + 15).GetCell(2).SetCellValue("No\r\n序号");
|
||
ws.GetRow(rowIndex + 15).GetCell(3).SetCellValue("Isometric Drawing No\r\n单线图号");
|
||
ws.GetRow(rowIndex + 15).GetCell(9).SetCellValue("Line Number No\r\n管线号");
|
||
ws.GetRow(rowIndex + 15).GetCell(14).SetCellValue("Rev\r\n版本");
|
||
ws.GetRow(rowIndex + 15).GetCell(15).SetCellValue("Sheet No.\r\n页码");
|
||
ws.GetRow(rowIndex + 15).GetCell(16).SetCellValue("Remark\r\n备注");
|
||
ws.GetRow(rowIndex + 15).Height = 40 * 20;
|
||
|
||
style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 11, false, false, "Arial Unicode MS");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 16, rowIndex + 53, style, 0, 17, true);
|
||
|
||
var dataTit = rowIndex + 16;
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (i == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 37;
|
||
}
|
||
else
|
||
{
|
||
dStart = i == 2 ? 37 : ((i - 2) * 37) + 37;
|
||
dEnd = ((i - 1) * 37) + 37;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int nextRow = 0;
|
||
int lastRow = 0;
|
||
int j = 0;
|
||
|
||
for (int k = 0; k < 37; k++)
|
||
{
|
||
int dataIndex = dataTit + j;
|
||
|
||
if (pageTb.Rows.Count > k)
|
||
{
|
||
DataRow dr = pageTb.Rows[k];
|
||
ws.GetRow(dataIndex).GetCell(2).SetCellValue($"{j + 1}");
|
||
ws.GetRow(dataIndex).GetCell(3).SetCellValue(dr["SingleNumber"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(9).SetCellValue(dr["PipelineCode"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(14).SetCellValue(dr["DrawingsNum"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(15).SetCellValue(dr["PageNum"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(16).SetCellValue(dr["Remark"].ToString());
|
||
}
|
||
|
||
ws.GetRow(dataIndex).Height = 14 * 20;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + dataIndex, rowIndex + dataIndex, 3, 8));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + dataIndex, rowIndex + dataIndex, 9, 13));
|
||
ws.GetRow(dataIndex).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
ws.GetRow(dataIndex).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
RegionUtil.SetBorderLeft(1, new CellRangeAddress(dataIndex, dataIndex, 2, 16), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 2, 2), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 8, 8), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 13, 13), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 14, 14), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 15, 15), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 16, 16), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(dataIndex, dataIndex, 2, 16), ws);
|
||
nextRow = dataIndex;
|
||
j++;
|
||
}
|
||
|
||
#region 注释
|
||
//foreach (DataRow dr in pageTb.Rows)
|
||
//{
|
||
// int dataIndex = dataTit + j;
|
||
// ws.GetRow(dataIndex).GetCell(2).SetCellValue($"{j + 1}");
|
||
// ws.GetRow(dataIndex).GetCell(3).SetCellValue(dr["SingleNumber"].ToString());
|
||
// ws.GetRow(dataIndex).GetCell(9).SetCellValue(dr["PipelineCode"].ToString());
|
||
// ws.GetRow(dataIndex).GetCell(14).SetCellValue(dr["DrawingsNum"].ToString());
|
||
// ws.GetRow(dataIndex).GetCell(15).SetCellValue(dr["PageNum"].ToString());
|
||
// ws.GetRow(dataIndex).GetCell(16).SetCellValue(dr["Remark"].ToString());
|
||
// ws.GetRow(dataIndex).Height = 14 * 20;
|
||
// ws.AddMergedRegion(new CellRangeAddress(rowIndex + dataIndex, rowIndex + dataIndex, 3, 8));
|
||
// ws.AddMergedRegion(new CellRangeAddress(rowIndex + dataIndex, rowIndex + dataIndex, 9, 13));
|
||
// ws.GetRow(dataIndex).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
// ws.GetRow(dataIndex).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
// RegionUtil.SetBorderLeft(1, new CellRangeAddress(dataIndex, dataIndex, 2, 16), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 2, 2), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 8, 8), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 13, 13), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 14, 14), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 15, 15), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 16, 16), ws);
|
||
// RegionUtil.SetBorderBottom(1, new CellRangeAddress(dataIndex, dataIndex, 2, 16), ws);
|
||
// nextRow = dataIndex;
|
||
// j++;
|
||
//}
|
||
//如果pageData不满足33行数据的情况下,将设置剩余行高
|
||
//if (pageTb.Rows.Count < 34)
|
||
//{
|
||
// for (int k = 1; k <= 34 - pageTb.Rows.Count; k++)
|
||
// {
|
||
// int dataIndex = rowIndex + nextRow + k;
|
||
// ws.GetRow(dataIndex).Height = 14 * 20;
|
||
// ws.GetRow(dataIndex).GetCell(0).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None);
|
||
// ws.GetRow(dataIndex).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
// ws.GetRow(dataIndex).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
// ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 3, 8));
|
||
// ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 9, 13));
|
||
// RegionUtil.SetBorderLeft(1, new CellRangeAddress(dataIndex, dataIndex, 2, 16), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 2, 2), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 8, 8), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 13, 13), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 14, 14), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 15, 15), ws);
|
||
// RegionUtil.SetBorderRight(1, new CellRangeAddress(dataIndex, dataIndex, 16, 16), ws);
|
||
// RegionUtil.SetBorderBottom(1, new CellRangeAddress(dataIndex, dataIndex, 2, 16), ws);
|
||
// lastRow = nextRow + k;
|
||
// }
|
||
//}
|
||
#endregion
|
||
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + lastRow, rowIndex + lastRow, 2, 16), ws);
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex + 53, rowIndex + 58, style, 0, 17, 13);
|
||
//ws.GetRow(rowIndex + 50).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 51).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 52).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 53).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 54).Height = 18 * 20;
|
||
//ws.GetRow(rowIndex + 55).Height = 4 * 20;
|
||
RegionUtil.SetBorderLeft(2, new CellRangeAddress(rowIndex + 53, rowIndex + 58, 1, 1), ws);
|
||
RegionUtil.SetBorderLeft(2, new CellRangeAddress(rowIndex + 53, rowIndex + 58, 17, 17), ws);
|
||
|
||
RegionUtil.SetBorderLeft(2, new CellRangeAddress(rowIndex + 53, rowIndex + 57, 2, 2), ws);
|
||
RegionUtil.SetBorderLeft(2, new CellRangeAddress(rowIndex + 53, rowIndex + 57, 17, 17), ws);
|
||
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 55, rowIndex + 55, 2, 16), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 53, rowIndex + 55, 4, 4), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 53, rowIndex + 55, 6, 6), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 53, rowIndex + 55, 9, 9), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 53, rowIndex + 55, 13, 13), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 56, rowIndex + 56, 4, 4), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 56, rowIndex + 56, 4, 4), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 56, rowIndex + 56, 6, 6), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 56, rowIndex + 56, 9, 9), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 56, rowIndex + 56, 13, 13), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 56, rowIndex + 57, 2, 16), ws);
|
||
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 57, rowIndex + 57, 2, 6), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 57, rowIndex + 57, 6, 6), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 57, rowIndex + 57, 9, 9), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 57, rowIndex + 57, 13, 13), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 53, rowIndex + 58, 17, 17), ws);
|
||
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 58, rowIndex + 58, 1, 17), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 2, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 5, 6));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 7, 9));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 10, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 14, 16));
|
||
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 56, 2, 4));
|
||
ws.GetRow(rowIndex + 56).GetCell(2).SetCellValue("PREPARED");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 56, 5, 6));
|
||
ws.GetRow(rowIndex + 56).GetCell(5).SetCellValue("REVIEW");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 57, 7, 9));
|
||
ws.GetRow(rowIndex + 56).GetCell(7).SetCellValue("JIANLI");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 57, 10, 13));
|
||
ws.GetRow(rowIndex + 56).GetCell(10).SetCellValue("Worley");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 57, 14, 16));
|
||
ws.GetRow(rowIndex + 56).GetCell(14).SetCellValue("BASF");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 57, rowIndex + 57, 2, 6));
|
||
ws.GetRow(rowIndex + 57).GetCell(2).SetCellValue("CC7");
|
||
|
||
#endregion
|
||
|
||
rowIndex = rowIndex + 59;
|
||
}
|
||
#endregion
|
||
|
||
|
||
ws.PrintSetup.Landscape = false;
|
||
ws.ForceFormulaRecalculation = true;
|
||
|
||
|
||
//ws.PrintSetup.FitWidth = 1;
|
||
//ws.PrintSetup.FitHeight = 0;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//ws.PrintSetup.Scale = 85;
|
||
//ws.FitToPage = true;
|
||
//垂直水平居中
|
||
ws.VerticallyCenter = true;
|
||
ws.HorizontallyCenter = true;
|
||
|
||
|
||
////打印边距设置
|
||
//ws.SetMargin(MarginType.RightMargin, 0);
|
||
//ws.SetMargin(MarginType.LeftMargin, 0);
|
||
//ws.SetMargin(MarginType.TopMargin, 0);
|
||
//ws.SetMargin(MarginType.BottomMargin, 0);
|
||
|
||
////页眉页脚间距
|
||
//ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
//ws.SetMargin(MarginType.FooterMargin, 0);
|
||
}
|
||
|
||
//11-TP-07-盲板清单UG-FW-001
|
||
private void template11(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
//插入图片部分
|
||
var img1 = Server.MapPath("~/res/images/bsf/1.png");
|
||
var img2 = Server.MapPath("~/res/images/bsf/2.png");
|
||
var img3 = Server.MapPath("~/res/images/bsf/3.png");
|
||
var img4 = Server.MapPath("~/res/images/bsf/4.png");
|
||
|
||
int rowIndex = 0;
|
||
|
||
//模拟数据
|
||
string sql = @"select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 37 ? 1 : Math.Ceiling((float)(tbNum - 37) / 37) + 1;
|
||
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
#region 头部
|
||
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex, rowIndex + 14, style, 0, 17, 13);
|
||
ws.GetRow(rowIndex).GetCell(15).SetCellValue("Form No.");
|
||
ws.GetRow(rowIndex).GetCell(16).SetCellValue("TP-06");
|
||
//设置列宽度
|
||
ws.SetColumnWidth(0, 1 * 256);
|
||
ws.SetColumnWidth(1, 2 * 256);
|
||
ws.SetColumnWidth(2, 9 * 256);
|
||
ws.SetColumnWidth(3, 4 * 256);
|
||
ws.SetColumnWidth(4, 4 * 256);
|
||
ws.SetColumnWidth(5, 4 * 256);
|
||
ws.SetColumnWidth(6, 5 * 256);
|
||
ws.SetColumnWidth(7, 4 * 256);
|
||
ws.SetColumnWidth(8, 4 * 256);
|
||
ws.SetColumnWidth(9, 4 * 256);
|
||
ws.SetColumnWidth(10, 4 * 256);
|
||
ws.SetColumnWidth(11, 4 * 256);
|
||
ws.SetColumnWidth(12, 4 * 256);
|
||
ws.SetColumnWidth(13, 4 * 256);
|
||
ws.SetColumnWidth(14, 8 * 256);
|
||
ws.SetColumnWidth(15, 9 * 256);
|
||
ws.SetColumnWidth(16, 9 * 256);
|
||
ws.SetColumnWidth(17, 2 * 256);
|
||
|
||
////设置列宽度
|
||
//ws.SetColumnWidth(0, 2 * 256);
|
||
//ws.SetColumnWidth(1, 1 * 256);
|
||
//ws.SetColumnWidth(2, 8 * 256);
|
||
//ws.SetColumnWidth(3, 5 * 256);
|
||
//ws.SetColumnWidth(4, 5 * 256);
|
||
//ws.SetColumnWidth(5, 8 * 256);
|
||
//ws.SetColumnWidth(6, 8 * 256);
|
||
//ws.SetColumnWidth(7, 10 * 256);
|
||
//ws.SetColumnWidth(8, 10 * 256);
|
||
//ws.SetColumnWidth(9, 11 * 256);
|
||
//ws.SetColumnWidth(10, 9 * 256);
|
||
//ws.SetColumnWidth(11, 8 * 256);
|
||
//ws.SetColumnWidth(12, 1 * 256);
|
||
//ws.SetColumnWidth(13, 9 * 256);
|
||
//ws.SetColumnWidth(14, 9 * 256);
|
||
//ws.SetColumnWidth(15, 9 * 256);
|
||
//ws.SetColumnWidth(16, 8 * 256);
|
||
//ws.SetColumnWidth(17, 1 * 256);
|
||
////设置前3行高度
|
||
//ws.GetRow(0).Height = 15 * 20;
|
||
//ws.GetRow(1).Height = 15 * 20;
|
||
//ws.GetRow(2).Height = 14 * 20;
|
||
|
||
////设置3-15行的行高度
|
||
//for (int i = 3; i < 15; i++)
|
||
//{
|
||
// ws.GetRow(i).Height = 18 * 20;
|
||
//}
|
||
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex, rowIndex, 1, 1), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 17), ws);
|
||
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 16, 16), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 17), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 2, 16), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 2, rowIndex + 2, 2, 16), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 1, rowIndex + 14, 0, 0), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 1, 1), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 16, 16), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 17, 17), ws);
|
||
|
||
|
||
RegionUtil.SetBorderLeft(2, new CellRangeAddress(rowIndex + 9, rowIndex + 14, 2, 2), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 7, rowIndex + 7, 2, 16), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 8, rowIndex + 8, 2, 16), ws);
|
||
//插入图片
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 2, rowIndex + 4, 3, img1, 1.2, 1.8);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 3, rowIndex + 4, 4, img2, 1.9, 1.9);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 13, rowIndex + 4, 14, img3, 1.5, 1.5);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 15, rowIndex + 4, 16, img4, 1.5, 1.5);
|
||
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("巴斯夫(广东)一体化项目");
|
||
var setStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
ws.GetRow(rowIndex + 3).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 13));
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("BASF (GUANGDONG) INTEGRATED PROJECT");
|
||
ws.GetRow(rowIndex + 4).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 5, 13));
|
||
ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue("试压包盲板清单");
|
||
ws.GetRow(rowIndex + 5).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 13));
|
||
ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue("TEST PACKAGE BLIND LIST");
|
||
ws.GetRow(rowIndex + 6).GetCell(5).CellStyle = setStyle;
|
||
|
||
var cellStyle2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 11, false, false, "Arial Unicode MS");
|
||
ws.GetRow(rowIndex + 9).GetCell(2).SetCellValue("Test Package No");
|
||
ws.GetRow(rowIndex + 9).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 9).GetCell(5).SetCellValue(info?.testpackageNo);
|
||
ws.GetRow(rowIndex + 9).GetCell(5).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 9).GetCell(9).SetCellValue("Area");
|
||
ws.GetRow(rowIndex + 9).GetCell(9).CellStyle = cellStyle2;
|
||
ws.GetRow(rowIndex + 9).GetCell(13).SetCellValue(info?.workAreaCode);
|
||
|
||
ws.GetRow(rowIndex + 10).GetCell(2).SetCellValue("试压包号");
|
||
ws.GetRow(rowIndex + 10).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 10).GetCell(9).SetCellValue("区域");
|
||
ws.GetRow(rowIndex + 10).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(2).SetCellValue("System No");
|
||
ws.GetRow(rowIndex + 11).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(5).SetCellValue(info?.SystemNo);
|
||
ws.GetRow(rowIndex + 11).GetCell(5).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(9).SetCellValue("Test Pressure");
|
||
ws.GetRow(rowIndex + 11).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(13).SetCellValue(info?.TestPressure);
|
||
ws.GetRow(rowIndex + 11).GetCell(13).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 12).GetCell(2).SetCellValue("系统号");
|
||
ws.GetRow(rowIndex + 12).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 12).GetCell(9).SetCellValue("试验压力");
|
||
ws.GetRow(rowIndex + 12).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 13).GetCell(9).SetCellValue("Test Type");
|
||
ws.GetRow(rowIndex + 13).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 13).GetCell(13).SetCellValue(info?.TestType);
|
||
ws.GetRow(rowIndex + 13).GetCell(13).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 14).GetCell(9).SetCellValue("试验方式");
|
||
ws.GetRow(rowIndex + 14).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 13));
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
var dataTit = rowIndex + 15;
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 37;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 37 : ((num - 2) * 37) + 37;
|
||
dEnd = ((num - 1) * 37) + 37;
|
||
}
|
||
|
||
style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial");
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex + 15, rowIndex + 52, style, 0, 17, 13);
|
||
//数据表头部分
|
||
ws.GetRow(rowIndex + 15).GetCell(2).SetCellValue("No\r\n序号");
|
||
ws.GetRow(rowIndex + 15).GetCell(3).SetCellValue("Isometric Drawing No.\r\n单线图号");
|
||
ws.GetRow(rowIndex + 15).GetCell(7).SetCellValue("Blind No.\r\n盲板编号");
|
||
ws.GetRow(rowIndex + 15).GetCell(8).SetCellValue("Inch\r\n尺寸");
|
||
ws.GetRow(rowIndex + 15).GetCell(9).SetCellValue("Thick(mm)\r\n厚度");
|
||
ws.GetRow(rowIndex + 15).GetCell(10).SetCellValue("Material\r\n材质");
|
||
ws.GetRow(rowIndex + 15).GetCell(11).SetCellValue("Installed Date\r\n安装日期");
|
||
ws.GetRow(rowIndex + 15).GetCell(14).SetCellValue("Removed Date\r\n拆除日期");
|
||
ws.GetRow(rowIndex + 15).GetCell(16).SetCellValue("Remark\r\n备注");
|
||
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int j = 0;
|
||
for (int i = 15; i <= 52; i++)
|
||
{
|
||
if (i == 15)
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 50 * 20;
|
||
}
|
||
else
|
||
{
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
DataRow dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(2).SetCellValue(j + 1);
|
||
ws.GetRow(rowIndex + i).GetCell(3).SetCellValue(dr["PTP_ID"].ToString());
|
||
}
|
||
j++;
|
||
}
|
||
|
||
ws.GetRow(rowIndex + i).GetCell(0).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None);
|
||
ws.GetRow(rowIndex + i).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
ws.GetRow(rowIndex + i).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 3, 6));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 11, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 14, 15));
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
//此处的尾部行数需要根据 得到的动态数据量 来计算,默认写死从50行开始。
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex + 53, rowIndex + 59, style, 0, 17, 13);
|
||
for (int i = rowIndex + 53; i <= rowIndex + 59; i++)
|
||
{
|
||
ws.GetRow(i).GetCell(0).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.Medium);
|
||
ws.GetRow(i).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.Medium);
|
||
ws.GetRow(i).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
}
|
||
|
||
for (int i = 2; i < 17; i++)
|
||
{
|
||
ws.GetRow(rowIndex + 59).GetCell(i).CellStyle = SetStyle(hssfworkbook, BorderStyle.Medium, BorderStyle.Medium, BorderStyle.None, BorderStyle.None);
|
||
}
|
||
ws.GetRow(rowIndex + 59).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium, BorderStyle.None);
|
||
ws.GetRow(rowIndex + 59).GetCell(16).CellStyle = SetStyle(hssfworkbook, BorderStyle.Medium, BorderStyle.Medium, BorderStyle.None, BorderStyle.None);
|
||
ws.GetRow(rowIndex + 59).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.Medium, BorderStyle.None, BorderStyle.Medium);
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 2, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 5, 6));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 7, 9));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 10, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 53, rowIndex + 55, 14, 16));
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 56, 2, 4));
|
||
ws.GetRow(rowIndex + 56).GetCell(2).SetCellValue("PREPARED");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 56, 5, 6));
|
||
ws.GetRow(rowIndex + 56).GetCell(5).SetCellValue("REVIEW");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 57, 7, 9));
|
||
ws.GetRow(rowIndex + 56).GetCell(7).SetCellValue("JIANLI");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 57, 10, 13));
|
||
ws.GetRow(rowIndex + 56).GetCell(10).SetCellValue("Worley");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 56, rowIndex + 57, 14, 16));
|
||
ws.GetRow(rowIndex + 56).GetCell(14).SetCellValue("BASF");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 57, rowIndex + 57, 2, 6));
|
||
ws.GetRow(rowIndex + 57).GetCell(2).SetCellValue("CC7");
|
||
|
||
#endregion
|
||
|
||
rowIndex = rowIndex + 60;
|
||
}
|
||
|
||
ws.PrintSetup.Landscape = false;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
ws.VerticallyCenter = true;
|
||
ws.HorizontallyCenter = true;
|
||
////打印边距设置
|
||
//ws.SetMargin(MarginType.RightMargin, 0);
|
||
//ws.SetMargin(MarginType.LeftMargin, 0);
|
||
//ws.SetMargin(MarginType.TopMargin, 0);
|
||
//ws.SetMargin(MarginType.BottomMargin, 0);
|
||
////页眉页脚间距
|
||
//ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
//ws.SetMargin(MarginType.FooterMargin, 0);
|
||
}
|
||
|
||
//13-弹簧支吊架安装检验记录SHT 3503-J403
|
||
private void template13(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
|
||
//模拟数据
|
||
string sql = @"select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 8 ? 1 : Math.Ceiling((float)(tbNum - 8) / 8) + 1;
|
||
|
||
int rowIndex = 0;
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex, style, 1, 7, true);
|
||
|
||
//设置列宽度
|
||
ws.SetColumnWidth(0, 2 * 256);
|
||
ws.SetColumnWidth(1, 16 * 256);
|
||
ws.SetColumnWidth(2, 16 * 256);
|
||
ws.SetColumnWidth(3, 16 * 256);
|
||
ws.SetColumnWidth(4, 16 * 256);
|
||
ws.SetColumnWidth(5, 16 * 256);
|
||
ws.SetColumnWidth(6, 19 * 256);
|
||
ws.SetColumnWidth(7, 19 * 256);
|
||
|
||
ws.GetRow(rowIndex).Height = 20 * 20 * 6;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 1, 2));
|
||
ws.GetRow(rowIndex).GetCell(1).SetCellValue("SH/T 3503—J403");
|
||
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
style1.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 5));
|
||
ws.GetRow(rowIndex).GetCell(3).CellStyle = style1;
|
||
ws.GetRow(rowIndex).GetCell(3).SetCellValue("弹簧支/吊架安装检验记录\nSpring Support/Hanger Installation Inspection Record");
|
||
|
||
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, false, false, "Arial Unicode MS");
|
||
style2.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 6, 7));
|
||
ws.GetRow(rowIndex).GetCell(6).CellStyle = style2;
|
||
ws.GetRow(rowIndex).GetCell(6).SetCellValue($"工程名称:{info?.projectName}\n\nProject Name:{info?.enProjectName}\n\n单位工程名称:{info?.workAreaName}\nUnit Name:{info?.enWorkAreaName}");
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 9, style, 1, 7, true);
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 8;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 8 : ((num - 2) * 8) + 8;
|
||
dEnd = ((num - 1) * 8) + 8;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int j = 0;
|
||
for (int i = 1; i <= 9; i++)
|
||
{
|
||
if (i == 1)
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 20 * 20 * 3;
|
||
ws.GetRow(rowIndex + i).GetCell(1).SetCellValue("管道编号/单线号\nPiping No./Line No.");
|
||
ws.GetRow(rowIndex + i).GetCell(2).SetCellValue("支/吊架位号\nSupport/Hanger Item No.");
|
||
ws.GetRow(rowIndex + i).GetCell(3).SetCellValue("结构型式\nType");
|
||
ws.GetRow(rowIndex + i).GetCell(4).SetCellValue("位移方向\nDisplacement Direction");
|
||
ws.GetRow(rowIndex + i).GetCell(5).SetCellValue("设计冷态负荷值\nDesign Cold Load");
|
||
ws.GetRow(rowIndex + i).GetCell(6).SetCellValue("安装冷态负荷值\nInstallation Cold Load");
|
||
ws.GetRow(rowIndex + i).GetCell(7).SetCellValue("检查结果\nInspection Result");
|
||
}
|
||
else
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 20 * 20;
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
var dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(1).SetCellValue("模拟数据");
|
||
}
|
||
j++;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 10, rowIndex + 12, style, 1, 7, true);
|
||
|
||
ws.GetRow(rowIndex + 10).Height = 20 * 20 * 2;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 10, rowIndex + 10, 1, 7));
|
||
ws.GetRow(rowIndex + 10).GetCell(1).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 10).GetCell(1).SetCellValue(" 备注:\n Remarks:");
|
||
|
||
ws.GetRow(rowIndex + 11).Height = 20 * 20 * 2;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 1, 2));
|
||
ws.GetRow(rowIndex + 11).GetCell(1).SetCellValue("建设/监理单位\nOwner/JianLi Contractor");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 3, 5));
|
||
ws.GetRow(rowIndex + 11).GetCell(3).SetCellValue("总 承 包 单 位\nGeneral Contractor");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 6, 7));
|
||
ws.GetRow(rowIndex + 11).GetCell(6).SetCellValue("施 工 单 位\nConstruction Contractor");
|
||
|
||
ws.GetRow(rowIndex + 12).Height = 20 * 20 * 6;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 12, 1, 2));
|
||
ws.GetRow(rowIndex + 12).GetCell(1).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 12).GetCell(1).SetCellValue(" 专业工程师:\n Discipline Engineer:\n\n\n\n\n 日期(DATE): 年 月 日");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 12, 3, 5));
|
||
ws.GetRow(rowIndex + 12).GetCell(3).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 12).GetCell(3).SetCellValue(" 专业工程师:\n Discipline Engineer:\n\n\n\n\n 日期(DATE): 年 月 日");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 12, 6, 7));
|
||
ws.GetRow(rowIndex + 12).GetCell(6).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 12).GetCell(6).SetCellValue(" 施工班组长:\n Foreman:\n 质量检查员:\n Quality Inspector:\n 专业工程师:\n Discipline Engineer: \n 日期(DATE): 年 月 日");
|
||
|
||
#endregion
|
||
|
||
rowIndex += 13;
|
||
|
||
|
||
}
|
||
ws.PrintSetup.Landscape = true;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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.VerticallyCenter = true;
|
||
//ws.HorizontallyCenter = true;
|
||
////打印边距设置 厘米/3
|
||
//ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
|
||
//ws.SetMargin(MarginType.LeftMargin, (double)2.9 / 3);
|
||
//ws.SetMargin(MarginType.TopMargin, (double)2.4 / 3);
|
||
//ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
|
||
////页眉页脚间距
|
||
//ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
//ws.SetMargin(MarginType.FooterMargin, 0);
|
||
}
|
||
|
||
//14-滑动固定管托安装检验记录SHT 3503-J404
|
||
private void template14(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
|
||
//模拟数据
|
||
string sql = @"select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 8 ? 1 : Math.Ceiling((float)(tbNum - 8) / 8) + 1;
|
||
|
||
int rowIndex = 0;
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 1, style, 1, 7, true);
|
||
|
||
//设置列宽度
|
||
ws.SetColumnWidth(0, 2 * 256);
|
||
ws.SetColumnWidth(1, 16 * 256);
|
||
ws.SetColumnWidth(2, 16 * 256);
|
||
ws.SetColumnWidth(3, 16 * 256);
|
||
ws.SetColumnWidth(4, 16 * 256);
|
||
ws.SetColumnWidth(5, 16 * 256);
|
||
ws.SetColumnWidth(6, 19 * 256);
|
||
ws.SetColumnWidth(7, 19 * 256);
|
||
ws.GetRow(rowIndex).Height = 20 * 20 * 5;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 1, 2));
|
||
ws.GetRow(rowIndex).GetCell(1).SetCellValue("SH/T 3503—J404");
|
||
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
style1.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 5));
|
||
ws.GetRow(rowIndex).GetCell(3).CellStyle = style1;
|
||
ws.GetRow(rowIndex).GetCell(3).SetCellValue("滑动/固定管托安装检验记录\nSliding/Fixed Pipe Shoe Installation Inspection Record");
|
||
|
||
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, false, false, "Arial Unicode MS");
|
||
style2.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 6, 7));
|
||
ws.GetRow(rowIndex).GetCell(6).CellStyle = style2;
|
||
ws.GetRow(rowIndex).GetCell(6).SetCellValue($"工程名称:{info?.projectName}\nProject Name:{info?.enProjectName}\n\n单位工程名称:{info?.workAreaName}\n Unit Name:{info?.enWorkAreaName}");
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 9, style, 1, 7, true);
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 8;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 8 : ((num - 2) * 8) + 8;
|
||
dEnd = ((num - 1) * 8) + 8;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int j = 0;
|
||
for (int i = 1; i <= 9; i++)
|
||
{
|
||
if (i == 1)
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 20 * 20 * 2;
|
||
ws.GetRow(rowIndex + i).GetCell(1).SetCellValue("管道编号/单线号\nPiping No./ Line");
|
||
ws.GetRow(rowIndex + i).GetCell(2).SetCellValue("管托编号\nPipe Shoe No.");
|
||
ws.GetRow(rowIndex + i).GetCell(3).SetCellValue("型 式\nType");
|
||
ws.GetRow(rowIndex + i).GetCell(4).SetCellValue("位移方向\nDisplacement Direction");
|
||
ws.GetRow(rowIndex + i).GetCell(5).SetCellValue("设计位移量\nDesign Displacement");
|
||
ws.GetRow(rowIndex + i).GetCell(6).SetCellValue("安装位移量\nInstallation Displacement");
|
||
ws.GetRow(rowIndex + i).GetCell(7).SetCellValue("检验结果\nInspection Result");
|
||
}
|
||
else
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 20 * 20;
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
var dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(1).SetCellValue("模拟数据");
|
||
}
|
||
j++;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 10, rowIndex + 13, style, 1, 7, true);
|
||
ws.GetRow(rowIndex + 10).Height = 20 * 20 * 2;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 10, rowIndex + 10, 1, 7));
|
||
ws.GetRow(rowIndex + 10).GetCell(1).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 10).GetCell(1).SetCellValue(" 注:本表用于设计温度>350℃管道和低于-29℃管道中,管托有位移要求的滑动和固定管托的安装检验。\nNote: This form is applicable to the installation inspection on sliding/fixed pipe shoes with displacement requirement used in piping at a design temperature above 350℃and in piping at a design temperature below -29℃.");
|
||
|
||
ws.GetRow(rowIndex + 11).Height = 20 * 20 * 2;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 1, 7));
|
||
ws.GetRow(rowIndex + 11).GetCell(1).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 11).GetCell(1).SetCellValue(" 备注:\n Remarks:");
|
||
|
||
ws.GetRow(rowIndex + 12).Height = 20 * 20 * 2;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 12, 1, 2));
|
||
ws.GetRow(rowIndex + 12).GetCell(1).SetCellValue("建设/监理单位\nOwner/JianLi Contractor");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 12, 3, 5));
|
||
ws.GetRow(rowIndex + 12).GetCell(3).SetCellValue("总 承 包 单 位\nGeneral Contractor");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 12, 6, 7));
|
||
ws.GetRow(rowIndex + 12).GetCell(6).SetCellValue("施 工 单 位\nConstruction Contractor");
|
||
|
||
ws.GetRow(rowIndex + 13).Height = 20 * 20 * 6;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 13, rowIndex + 13, 1, 2));
|
||
ws.GetRow(rowIndex + 13).GetCell(1).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 13).GetCell(1).SetCellValue(" 专业工程师:\n Discipline Engineer:\n\n\n\n\n 日期(DATE): 年 月 日");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 13, rowIndex + 13, 3, 5));
|
||
ws.GetRow(rowIndex + 13).GetCell(3).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 13).GetCell(3).SetCellValue(" 专业工程师:\n Discipline Engineer:\n\n\n\n\n 日期(DATE): 年 月 日");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 13, rowIndex + 13, 6, 7));
|
||
ws.GetRow(rowIndex + 13).GetCell(6).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 13).GetCell(6).SetCellValue(" 施工班组长:\n Foreman:\n 质量检查员:\n Quality Inspector:\n 专业工程师:\n Discipline Engineer: \n 日期(DATE): 年 月 日");
|
||
|
||
#endregion
|
||
|
||
rowIndex += 14;
|
||
}
|
||
|
||
ws.PrintSetup.Landscape = true;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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.VerticallyCenter = true;
|
||
//ws.HorizontallyCenter = true;
|
||
////打印边距设置 厘米/3
|
||
//ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
|
||
//ws.SetMargin(MarginType.LeftMargin, (double)2.9 / 3);
|
||
//ws.SetMargin(MarginType.TopMargin, (double)2.4 / 3);
|
||
//ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
|
||
|
||
////页眉页脚间距
|
||
//ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
//ws.SetMargin(MarginType.FooterMargin, 0);
|
||
}
|
||
|
||
//15-管道补偿器安装检验记录SHT 3503-J405
|
||
private void template15(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
|
||
//模拟数据
|
||
string sql = @"select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 16 ? 1 : Math.Ceiling((float)(tbNum - 16) / 16) + 1;
|
||
|
||
int rowIndex = 0;
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
#region 头部
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 11, true, false, "宋体");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 3, style, 0, 12, true);
|
||
|
||
//设置列宽
|
||
ws.SetColumnWidth(0, 14 * 256);//A
|
||
ws.SetColumnWidth(1, 8 * 256);//B
|
||
ws.SetColumnWidth(2, 8 * 256);//C
|
||
ws.SetColumnWidth(3, 9 * 256);//D
|
||
ws.SetColumnWidth(4, 9 * 256);//E
|
||
ws.SetColumnWidth(5, 8 * 256);//F
|
||
ws.SetColumnWidth(6, 13 * 256);//G
|
||
ws.SetColumnWidth(7, 9 * 256);//H
|
||
ws.SetColumnWidth(8, 13 * 256);//I
|
||
ws.SetColumnWidth(9, 9 * 256);//J
|
||
ws.SetColumnWidth(10, 9 * 256);//K
|
||
ws.SetColumnWidth(11, 9 * 256);//L
|
||
ws.SetColumnWidth(12, 10 * 256);//M
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 0, rowIndex + 3, 0, 1));
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3503-J405");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 0, rowIndex + 3, 2, 9));
|
||
ws.GetRow(rowIndex).GetCell(2).SetCellValue("管道补偿器安装检验记录\r\nPipe Compensator Installation Inspection Record");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 0, rowIndex + 0, 10, 12));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 10, 12));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 10, 12));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 10, 12));
|
||
|
||
ws.GetRow(rowIndex).GetCell(10).SetCellValue($"工程名称:{info?.projectName}");
|
||
ws.GetRow(rowIndex + 1).GetCell(10).SetCellValue($"Project Name:{info?.enProjectName}");
|
||
ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue($"单位工程名称:{info?.workAreaName}");
|
||
ws.GetRow(rowIndex + 3).GetCell(10).SetCellValue($"Unit Name:{info?.enWorkAreaName}");
|
||
|
||
ws.GetRow(rowIndex).HeightInPoints = 19.8f;
|
||
ws.GetRow(rowIndex + 1).HeightInPoints = 13.8f;
|
||
ws.GetRow(rowIndex + 2).HeightInPoints = 25f;
|
||
ws.GetRow(rowIndex + 3).HeightInPoints = 28f;
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 4, rowIndex + 5, style, 0, 12, true);
|
||
|
||
ws.GetRow(rowIndex + 4).HeightInPoints = 25f;
|
||
ws.GetRow(rowIndex + 5).HeightInPoints = 25f;
|
||
//设置表头部分
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 0, 0));
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("管道编号/单线号\r\nPiping No./Line No");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 1, 2));
|
||
ws.GetRow(rowIndex + 4).GetCell(1).SetCellValue("补偿器编号\r\nCompensator No.");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 3, 3));
|
||
ws.GetRow(rowIndex + 4).GetCell(3).SetCellValue("型式\r\nType");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 4, 4));
|
||
ws.GetRow(rowIndex + 4).GetCell(4).SetCellValue("规格\r\nSpecification");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 5, 5));
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("材质\r\nMaterial");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 6, 6));
|
||
ws.GetRow(rowIndex + 4).GetCell(6).SetCellValue("固定支架间距\r\nFixed Support SoacingM");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 7, 7));
|
||
ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("设计压力\r\nDesign Pressure");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 8, 8));
|
||
ws.GetRow(rowIndex + 4).GetCell(8).SetCellValue("设计温度\r\nDesign Temperature\r\n℃");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 9, 11));
|
||
ws.GetRow(rowIndex + 4).GetCell(9).SetCellValue("轴/角向预变形量\r\nAxial/Angular Predeformation");
|
||
ws.GetRow(rowIndex + 5).GetCell(9).SetCellValue("单位\r\nUnit");
|
||
ws.GetRow(rowIndex + 5).GetCell(10).SetCellValue("设计值\r\nDesign Value");
|
||
ws.GetRow(rowIndex + 5).GetCell(11).SetCellValue("实测值\r\nActual Value");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 12, 12));
|
||
ws.GetRow(rowIndex + 4).GetCell(12).SetCellValue("检验结果\r\nInspection Result");
|
||
|
||
//这里创建行数据
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 6, rowIndex + 21, style, 0, 12, true);
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 16;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 16 : ((num - 2) * 16) + 16;
|
||
dEnd = ((num - 1) * 16) + 16;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int j = 0;
|
||
for (int i = 6; i <= 21; i++)
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 17f;
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
var dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(0).SetCellValue("模拟数据");
|
||
}
|
||
j++;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Left, 11, true, false);
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 22, rowIndex + 28, style, 0, 12, true);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 22, rowIndex + 22, 0, 3));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 22, rowIndex + 22, 4, 8));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 22, rowIndex + 22, 9, 12));
|
||
ws.GetRow(rowIndex + 22).GetCell(0).SetCellValue("建设/监理单位\r\nOwner/Supervision Contractor");
|
||
ws.GetRow(rowIndex + 22).GetCell(4).SetCellValue("总承包单位\r\nGeneral Contractor");
|
||
ws.GetRow(rowIndex + 22).GetCell(9).SetCellValue("施工单位\r\nConstruction Contractor");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 0, 1));
|
||
ws.GetRow(rowIndex + 23).GetCell(0).SetCellValue("专业工程师\r\nDiscipline Engineer:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 9, 12));
|
||
ws.GetRow(rowIndex + 23).GetCell(9).SetCellValue("记录人 :\r\nRecord Prepared by:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 25, rowIndex + 25, 9, 12));
|
||
ws.GetRow(rowIndex + 25).GetCell(9).SetCellValue("质量检查员:\r\nQuality Inspector:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 27, rowIndex + 27, 9, 12));
|
||
ws.GetRow(rowIndex + 25).GetCell(9).SetCellValue("焊接责任工程师:\r\nWelding Engineer:");
|
||
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 28, rowIndex + 28, 0, 3));
|
||
ws.GetRow(rowIndex + 28).GetCell(0).SetCellValue("日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 28, rowIndex + 28, 4, 8));
|
||
ws.GetRow(rowIndex + 28).GetCell(4).SetCellValue("日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 28, rowIndex + 28, 9, 12));
|
||
ws.GetRow(rowIndex + 28).GetCell(9).SetCellValue("日期Date: 年 月 日");
|
||
|
||
RegionUtil.SetBorderTop(1, new CellRangeAddress(rowIndex + 22, rowIndex + 22, 0, 12), ws);
|
||
RegionUtil.SetBorderLeft(1, new CellRangeAddress(rowIndex + 22, rowIndex + 28, 0, 0), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 22, rowIndex + 28, 12, 12), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 28, rowIndex + 28, 0, 12), ws);
|
||
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 22, rowIndex + 28, 3, 3), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 22, rowIndex + 28, 8, 8), ws);
|
||
|
||
ws.GetRow(rowIndex + 22).HeightInPoints = 30f;
|
||
ws.GetRow(rowIndex + 23).HeightInPoints = 30f;
|
||
ws.GetRow(rowIndex + 24).HeightInPoints = 3f;
|
||
ws.GetRow(rowIndex + 25).HeightInPoints = 30f;
|
||
ws.GetRow(rowIndex + 26).HeightInPoints = 5f;
|
||
ws.GetRow(rowIndex + 27).HeightInPoints = 5f;
|
||
ws.GetRow(rowIndex + 28).HeightInPoints = 30f;
|
||
|
||
#endregion
|
||
|
||
rowIndex += 29;
|
||
}
|
||
|
||
ws.PrintSetup.Landscape = true;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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);
|
||
}
|
||
|
||
//16-TP-08-静电接地清单UG-FW-001
|
||
private void template16(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
//插入图片部分
|
||
var img1 = Server.MapPath("~/res/images/bsf/1.png");
|
||
var img2 = Server.MapPath("~/res/images/bsf/2.png");
|
||
var img3 = Server.MapPath("~/res/images/bsf/3.png");
|
||
var img4 = Server.MapPath("~/res/images/bsf/4.png");
|
||
|
||
//模拟数据
|
||
string sql = @"select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 24 ? 1 : Math.Ceiling((float)(tbNum - 24) / 24) + 1;
|
||
int rowIndex = 0;
|
||
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 14, style, 0, 17, true);
|
||
ws.GetRow(rowIndex).GetCell(14).SetCellValue("Form No.");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 14, 15));
|
||
ws.GetRow(rowIndex).GetCell(16).SetCellValue("TP-06");
|
||
//设置列宽度
|
||
ws.SetColumnWidth(0, 2 * 256);//A
|
||
ws.SetColumnWidth(1, 1 * 256);//B
|
||
ws.SetColumnWidth(2, 5 * 256);//C
|
||
ws.SetColumnWidth(3, 4 * 256);//D
|
||
ws.SetColumnWidth(4, 4 * 256);//E
|
||
ws.SetColumnWidth(5, 5 * 256);//F
|
||
ws.SetColumnWidth(6, 5 * 256);//G
|
||
ws.SetColumnWidth(7, 5 * 256);//H
|
||
ws.SetColumnWidth(8, 6 * 256);//I
|
||
ws.SetColumnWidth(9, 7 * 256);//J
|
||
ws.SetColumnWidth(10, 6 * 256);//K
|
||
ws.SetColumnWidth(11, 6 * 256);//L
|
||
ws.SetColumnWidth(12, 1 * 256);//M
|
||
ws.SetColumnWidth(13, 6 * 256);//N
|
||
ws.SetColumnWidth(14, 6 * 256);//O
|
||
ws.SetColumnWidth(15, 6 * 256);//P
|
||
ws.SetColumnWidth(16, 7 * 256);//Q
|
||
ws.SetColumnWidth(17, 1 * 256);//R
|
||
//设置前3行高度
|
||
ws.GetRow(rowIndex).Height = 15 * 20;
|
||
ws.GetRow(rowIndex + 1).Height = 15 * 20;
|
||
ws.GetRow(rowIndex + 2).Height = 14 * 20;
|
||
|
||
//设置3-15行的行高度
|
||
for (int i = rowIndex + 3; i < rowIndex + 15; i++)
|
||
{
|
||
ws.GetRow(i).Height = 18 * 20;
|
||
}
|
||
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex, rowIndex, 1, 1), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 17), ws);
|
||
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 16, 16), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 17), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 2, 16), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 2, rowIndex + 2, 2, 16), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 1, rowIndex + 14, 0, 0), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 1, 1), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 16, 16), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 17, 17), ws);
|
||
|
||
RegionUtil.SetBorderLeft(2, new CellRangeAddress(rowIndex + 9, rowIndex + 14, 2, 2), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 7, rowIndex + 7, 2, 16), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 8, rowIndex + 8, 2, 16), ws);
|
||
//插入图片
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 2, rowIndex + 4, 3, img1, 1.2, 1.8);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 3, rowIndex + 4, 4, img2, 1.9, 1.9);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 13, rowIndex + 4, 14, img3, 1.5, 1.5);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 15, rowIndex + 4, 16, img4, 1.5, 1.5);
|
||
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("巴斯夫(广东)一体化项目");
|
||
var setStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
ws.GetRow(rowIndex + 3).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 13));
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("BASF (GUANGDONG) INTEGRATED PROJECT");
|
||
ws.GetRow(rowIndex + 4).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 5, 13));
|
||
ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue("管道静电接地清单");
|
||
ws.GetRow(rowIndex + 5).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 13));
|
||
ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue("LIST OF PIPING ELECTROSTATIC GROUNDING");
|
||
ws.GetRow(rowIndex + 6).GetCell(5).CellStyle = setStyle;
|
||
|
||
var cellStyle2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 11, false, false, "Arial Unicode MS");
|
||
ws.GetRow(rowIndex + 9).GetCell(2).SetCellValue("Test Package No");
|
||
ws.GetRow(rowIndex + 9).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 9).GetCell(5).SetCellValue(info?.testpackageNo);
|
||
ws.GetRow(rowIndex + 9).GetCell(5).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 9).GetCell(9).SetCellValue("Area");
|
||
ws.GetRow(rowIndex + 9).GetCell(9).CellStyle = cellStyle2;
|
||
ws.GetRow(rowIndex + 9).GetCell(13).SetCellValue(info?.workAreaCode);
|
||
|
||
ws.GetRow(rowIndex + 10).GetCell(2).SetCellValue("试压包号");
|
||
ws.GetRow(rowIndex + 10).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 10).GetCell(9).SetCellValue("区域");
|
||
ws.GetRow(rowIndex + 10).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(2).SetCellValue("System No");
|
||
ws.GetRow(rowIndex + 11).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(5).SetCellValue(info?.SystemNo);
|
||
ws.GetRow(rowIndex + 11).GetCell(5).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(9).SetCellValue("Test Pressure");
|
||
ws.GetRow(rowIndex + 11).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(13).SetCellValue(info?.TestPressure);
|
||
ws.GetRow(rowIndex + 11).GetCell(13).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 12).GetCell(2).SetCellValue("系统号");
|
||
ws.GetRow(rowIndex + 12).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 12).GetCell(9).SetCellValue("试验压力");
|
||
ws.GetRow(rowIndex + 12).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 13).GetCell(9).SetCellValue("Test Type");
|
||
ws.GetRow(rowIndex + 13).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 13).GetCell(13).SetCellValue(info?.TestType);
|
||
ws.GetRow(rowIndex + 13).GetCell(13).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 14).GetCell(9).SetCellValue("试验方式");
|
||
ws.GetRow(rowIndex + 14).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 13));
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 11, true, false, "Arial Unicode MS");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 15, rowIndex + 40, style, 0, 17, true);
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 24;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 24 : ((num - 2) * 24) + 24;
|
||
dEnd = ((num - 1) * 24) + 24;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
|
||
ws.GetRow(rowIndex + 15).HeightInPoints = 28f;
|
||
//数据表头部分
|
||
ws.GetRow(rowIndex + 15).GetCell(2).SetCellValue("No\r\n序号");
|
||
ws.GetRow(rowIndex + 15).GetCell(3).SetCellValue("Isometric Drawing No\r\n单线图号");
|
||
ws.GetRow(rowIndex + 15).GetCell(8).SetCellValue("接头型式\r\nConnection Type");
|
||
ws.GetRow(rowIndex + 15).GetCell(10).SetCellValue("规格\r\nSpecification");
|
||
ws.GetRow(rowIndex + 15).GetCell(13).SetCellValue("材质\r\nMaterial");
|
||
ws.GetRow(rowIndex + 15).GetCell(16).SetCellValue("Remark\r\n备注");
|
||
|
||
int j = 0;
|
||
for (int i = 15; i <= 39; i++)
|
||
{
|
||
ws.GetRow(rowIndex + i).GetCell(0).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None);
|
||
ws.GetRow(rowIndex + i).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
ws.GetRow(rowIndex + i).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 3, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 8, 9));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 10, 12));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 13, 15));
|
||
if (i > 15)
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 18f;
|
||
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
var dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(3).SetCellValue(dr["PTP_ID"].ToString());
|
||
}
|
||
j++;
|
||
}
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
//此处的尾部行数需要根据 得到的动态数据量 来计算,默认写死从50行开始。
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 40, rowIndex + 45, style, 0, 17, true);
|
||
for (int i = rowIndex + 40; i <= rowIndex + 45; i++)
|
||
{
|
||
ws.GetRow(i).Height = 18 * 20;
|
||
ws.GetRow(i).GetCell(0).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.Medium);
|
||
ws.GetRow(i).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.Medium);
|
||
ws.GetRow(i).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
}
|
||
|
||
ws.GetRow(rowIndex + 40).HeightInPoints = 14f;
|
||
ws.GetRow(rowIndex + 41).HeightInPoints = 14f;
|
||
ws.GetRow(rowIndex + 42).HeightInPoints = 14f;
|
||
|
||
for (int i = 2; i < 17; i++)
|
||
{
|
||
ws.GetRow(rowIndex + 45).GetCell(i).CellStyle = SetStyle(hssfworkbook, BorderStyle.Medium, BorderStyle.Medium, BorderStyle.None, BorderStyle.None);
|
||
}
|
||
ws.GetRow(rowIndex + 45).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium, BorderStyle.None);
|
||
ws.GetRow(rowIndex + 45).GetCell(16).CellStyle = SetStyle(hssfworkbook, BorderStyle.Medium, BorderStyle.Medium, BorderStyle.None, BorderStyle.None);
|
||
ws.GetRow(rowIndex + 45).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.Medium, BorderStyle.None, BorderStyle.Medium);
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 40, rowIndex + 42, 2, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 40, rowIndex + 42, 5, 6));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 40, rowIndex + 42, 7, 9));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 40, rowIndex + 42, 10, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 40, rowIndex + 42, 14, 16));
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 43, rowIndex + 43, 2, 4));
|
||
ws.GetRow(rowIndex + 43).GetCell(2).SetCellValue("PREPARED");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 43, rowIndex + 43, 5, 6));
|
||
ws.GetRow(rowIndex + 43).GetCell(5).SetCellValue("REVIEW");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 43, rowIndex + 44, 7, 9));
|
||
ws.GetRow(rowIndex + 43).GetCell(7).SetCellValue("JIANLI");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 43, rowIndex + 44, 10, 13));
|
||
ws.GetRow(rowIndex + 43).GetCell(10).SetCellValue("Worley");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 43, rowIndex + 44, 14, 16));
|
||
ws.GetRow(rowIndex + 43).GetCell(14).SetCellValue("BASF");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 44, rowIndex + 44, 2, 6));
|
||
ws.GetRow(rowIndex + 44).GetCell(2).SetCellValue("CC7");
|
||
#endregion
|
||
|
||
rowIndex += 46;
|
||
|
||
}
|
||
|
||
|
||
ws.PrintSetup.Landscape = false;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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.VerticallyCenter = true;
|
||
//ws.HorizontallyCenter = true;
|
||
////打印边距设置 厘米/3
|
||
//ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
|
||
//ws.SetMargin(MarginType.LeftMargin, (double)2.9 / 3);
|
||
//ws.SetMargin(MarginType.TopMargin, (double)2.4 / 3);
|
||
//ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
|
||
////页眉页脚间距
|
||
//ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
//ws.SetMargin(MarginType.FooterMargin, 0);
|
||
|
||
}
|
||
|
||
//17-管道焊接接头热处理报告SHT 3503-J411
|
||
private void template17(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
|
||
//模拟数据
|
||
string sql = @"select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 9 ? 1 : Math.Ceiling((float)(tbNum - 9) / 9) + 1;
|
||
|
||
int rowIndex = 0;
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 2, style, 1, 12, true);
|
||
ws.SetColumnWidth(0, 1 * 256);//A
|
||
ws.SetColumnWidth(1, 11 * 256);//B
|
||
ws.SetColumnWidth(2, 9 * 256);//C
|
||
ws.SetColumnWidth(3, 11 * 256);//D
|
||
ws.SetColumnWidth(4, 9 * 256);//E
|
||
ws.SetColumnWidth(5, 11 * 256);//F
|
||
ws.SetColumnWidth(6, 11 * 256);//G
|
||
ws.SetColumnWidth(7, 11 * 256);//H
|
||
ws.SetColumnWidth(8, 10 * 256);//I
|
||
ws.SetColumnWidth(9, 10 * 256);//J
|
||
ws.SetColumnWidth(10, 10 * 256);//K
|
||
ws.SetColumnWidth(11, 11 * 256);//L
|
||
ws.SetColumnWidth(12, 11 * 256);//M
|
||
|
||
ws.GetRow(rowIndex).HeightInPoints = 100f;
|
||
ws.GetRow(rowIndex + 1).HeightInPoints = 18f;
|
||
ws.GetRow(rowIndex + 2).HeightInPoints = 50f;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 1, 4));
|
||
ws.GetRow(rowIndex).GetCell(1).SetCellValue("SH/T 3503—J411-1");
|
||
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
style1.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 5, 8));
|
||
ws.GetRow(rowIndex).GetCell(5).CellStyle = style1;
|
||
var title = num == 1 ? "管道焊接接头热处理报告\nPiping Welded Joint Heat Treatment Report" : "管道焊接接头热处理报告(续)\nPiping Welded Joint Heat Treatment Report(Continued)";
|
||
ws.GetRow(rowIndex).GetCell(5).SetCellValue(title);
|
||
|
||
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, false, false, "Arial Unicode MS");
|
||
style2.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 9, 12));
|
||
ws.GetRow(rowIndex).GetCell(9).CellStyle = style2;
|
||
ws.GetRow(rowIndex).GetCell(9).SetCellValue($"工程名称:{info?.projectName}\n\nProject Name:{info?.enProjectName}\n\n单位工程名称:{info?.workAreaName}\n\nUnit Name:{info?.enWorkAreaName}");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 2, 12));
|
||
ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("Report No.");
|
||
|
||
ws.GetRow(rowIndex + 2).GetCell(1).SetCellValue("Heat Treatment Method");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 2, 6));
|
||
ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("Heat Treatment Equipment");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 12));
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 3, rowIndex + 13, style, 1, 12, true);
|
||
for (int i = 3; i <= 13; i++)
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 20 * 20;
|
||
if (3 == i)
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 1, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 2, 2));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 3, 3));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 4, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 8, 8));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 9, 9));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 10, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 11, 11));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 12, 12));
|
||
}
|
||
if (4 == i)
|
||
continue;
|
||
}
|
||
ws.GetRow(rowIndex + 3).GetCell(1).SetCellValue("Piping No./Line No.");
|
||
ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue("Weld No.");
|
||
ws.GetRow(rowIndex + 3).GetCell(3).SetCellValue("Temp. Measuring Point No.");
|
||
ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("HT Temperature ℃");
|
||
ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("Holding Time h");
|
||
ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue("Material");
|
||
ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue("Specification");
|
||
ws.GetRow(rowIndex + 3).GetCell(10).SetCellValue("Heat Treatment Date");
|
||
ws.GetRow(rowIndex + 3).GetCell(11).SetCellValue("Recording Curve No.");
|
||
ws.GetRow(rowIndex + 3).GetCell(12).SetCellValue("Hardness Report No.");
|
||
|
||
ws.GetRow(rowIndex + 4).GetCell(4).SetCellValue("Required");
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("Actual");
|
||
ws.GetRow(rowIndex + 4).GetCell(6).SetCellValue("Required");
|
||
ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("Actual");
|
||
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 9;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 9 : ((num - 2) * 9) + 9;
|
||
dEnd = ((num - 1) * 9) + 9;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int j = 0;
|
||
for (int i = 5; i <= 13; i++)
|
||
{
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
var dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(2).SetCellValue(dr["PTP_ID"].ToString());
|
||
}
|
||
j++;
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 14, rowIndex + 16, style, 1, 12, true);
|
||
ws.GetRow(rowIndex + 14).Height = 18 * 20;
|
||
ws.GetRow(rowIndex + 15).Height = 18 * 20;
|
||
ws.GetRow(rowIndex + 16).Height = 18 * 20 * 4;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 14, rowIndex + 14, 1, 12));
|
||
ws.GetRow(rowIndex + 14).GetCell(1).SetCellValue("Conclusion:");
|
||
ws.GetRow(rowIndex + 14).GetCell(1).CellStyle = style2;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 1, 3));
|
||
ws.GetRow(rowIndex + 15).GetCell(1).SetCellValue("Owner/Supervision Contractor");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 4, 6));
|
||
ws.GetRow(rowIndex + 15).GetCell(4).SetCellValue("General Contractor");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 7, 9));
|
||
ws.GetRow(rowIndex + 15).GetCell(7).SetCellValue("Construction Contractor");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 10, 12));
|
||
ws.GetRow(rowIndex + 15).GetCell(10).SetCellValue("Heat Treatment Contractor");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 1, 3));
|
||
ws.GetRow(rowIndex + 16).GetCell(1).SetCellValue(" Discipline Engineer:\n\n\n\n Date:");
|
||
ws.GetRow(rowIndex + 16).GetCell(1).CellStyle = style2;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 4, 6));
|
||
ws.GetRow(rowIndex + 16).GetCell(4).SetCellValue(" Discipline Engineer:\n\n\n\n Date:");
|
||
ws.GetRow(rowIndex + 16).GetCell(4).CellStyle = style2;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 7, 9));
|
||
ws.GetRow(rowIndex + 16).GetCell(7).SetCellValue(" Foreman:\n Quality Inspector:\n Discipline Engineer:\n\n Date:");
|
||
ws.GetRow(rowIndex + 16).GetCell(7).CellStyle = style2;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 10, 12));
|
||
ws.GetRow(rowIndex + 16).GetCell(10).SetCellValue(" Operator:\n Discipline Engineer:\n\n\n Date:");
|
||
ws.GetRow(rowIndex + 16).GetCell(10).CellStyle = style2;
|
||
|
||
#endregion
|
||
|
||
rowIndex += 17;
|
||
|
||
}
|
||
ws.PrintSetup.Landscape = true;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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);
|
||
}
|
||
|
||
//18-金属材料化学成分检验报告SHT 3503-J129
|
||
private void template18(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
|
||
|
||
//模拟数据
|
||
string sql = @"select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 11 ? 1 : Math.Ceiling((float)(tbNum - 11) / 11) + 1;
|
||
|
||
int rowIndex = 0;
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 3, style, 1, 15, true);
|
||
|
||
ws.SetColumnWidth(0, 1 * 256);//A
|
||
ws.SetColumnWidth(1, 5 * 256);//B
|
||
ws.SetColumnWidth(2, 5 * 256);//C
|
||
ws.SetColumnWidth(3, 4 * 256);//D
|
||
ws.SetColumnWidth(4, 4 * 256);//E
|
||
ws.SetColumnWidth(5, 6 * 256);//F
|
||
ws.SetColumnWidth(6, 6 * 256);//G
|
||
ws.SetColumnWidth(7, 6 * 256);//H
|
||
ws.SetColumnWidth(8, 6 * 256);//I
|
||
ws.SetColumnWidth(9, 6 * 256);//J
|
||
ws.SetColumnWidth(10, 6 * 256);//K
|
||
ws.SetColumnWidth(11, 6 * 256);//L
|
||
ws.SetColumnWidth(12, 6 * 256);//M
|
||
ws.SetColumnWidth(13, 5 * 256);//N
|
||
ws.SetColumnWidth(14, 5 * 256);//O
|
||
ws.SetColumnWidth(15, 8 * 256);//P
|
||
|
||
//ws.SetColumnWidth(0, 2 * 256);
|
||
//for (int i = 1; i < 16; i++)
|
||
//{
|
||
// if (i == 3 || i == 4)
|
||
// ws.SetColumnWidth(i, 4 * 256);
|
||
// else if (i == 15)
|
||
// ws.SetColumnWidth(i, 8 * 256);
|
||
// else
|
||
// ws.SetColumnWidth(i, 5 * 256);
|
||
//}
|
||
|
||
|
||
ws.GetRow(rowIndex).Height = 20 * 20 * 6;
|
||
|
||
ws.GetRow(rowIndex + 1).HeightInPoints = 50;
|
||
ws.GetRow(rowIndex + 2).HeightInPoints = 60;
|
||
ws.GetRow(rowIndex + 3).HeightInPoints = 50;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 1, 4));
|
||
ws.GetRow(rowIndex).GetCell(1).SetCellValue("SH/T 3503—J129");
|
||
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
style1.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 5, 10));
|
||
ws.GetRow(rowIndex).GetCell(5).CellStyle = style1;
|
||
ws.GetRow(rowIndex).GetCell(5).SetCellValue($"金属材料化学成分检验报告\nMetal Material Chemical Composition Test Report\n\n第 {num} 页 共 {pageNum} 页 Page of ");
|
||
|
||
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, false, false, "Arial Unicode MS");
|
||
style2.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 11, 15));
|
||
ws.GetRow(rowIndex).GetCell(11).CellStyle = style2;
|
||
ws.GetRow(rowIndex).GetCell(11).SetCellValue($"工程名称:{info?.projectName}\nProject Name:{info?.enProjectName}\n单位工程名称:{info?.workAreaName}\nUnit Name:{info?.enWorkAreaName}");
|
||
|
||
for (int i = 1; i < 4; i++)
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 1, 2));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 3, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 8, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 11, 12));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 13, 15));
|
||
}
|
||
ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("委托单位\nEntrusted by");
|
||
ws.GetRow(rowIndex + 1).GetCell(6).SetCellValue("施工单位\nConstruction Contractor");
|
||
ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue("报告编号\nReport No.");
|
||
ws.GetRow(rowIndex + 2).GetCell(1).SetCellValue("检件名称\nTest Piece Description");
|
||
ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("检验标准\nTest Criteria");
|
||
ws.GetRow(rowIndex + 2).GetCell(11).SetCellValue("被检验材料标准\nMaterial Specification");
|
||
ws.GetRow(rowIndex + 3).GetCell(1).SetCellValue("检验方法\nTest Method");
|
||
ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("设备型号\nEquipment Model");
|
||
ws.GetRow(rowIndex + 3).GetCell(11).SetCellValue("检件材质\nTest Piece Material");
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 4, rowIndex + 16, style, 1, 15, true);
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 11;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 11 : ((num - 2) * 11) + 11;
|
||
dEnd = ((num - 1) * 11) + 11;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int j = 0;
|
||
for (int i = 4; i < 17; i++)
|
||
{
|
||
|
||
if (i == 5)
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 70f;
|
||
continue;
|
||
}
|
||
if (i == 4)
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 60f;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 1, 2));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 3, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 5, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 6, 15));
|
||
}
|
||
else
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 20f;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 1, 2));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 3, 4));
|
||
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
var dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(3).SetCellValue(dr["PTP_ID"].ToString());
|
||
}
|
||
j++;
|
||
|
||
}
|
||
|
||
}
|
||
ws.GetRow(rowIndex + 4).GetCell(1).SetCellValue("质量证明文件编号/炉批号\nQuality Certificate No./Heat No. or Lot No.");
|
||
ws.GetRow(rowIndex + 4).GetCell(3).SetCellValue("检验部位编号\nTest Position No.");
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("规格\nSpecification");
|
||
ws.GetRow(rowIndex + 4).GetCell(6).SetCellValue("元素含量%\nElement Content");
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 17, rowIndex + 23, style, 1, 15, true);
|
||
ws.GetRow(rowIndex + 17).Height = 20 * 20 * 4;
|
||
ws.GetRow(rowIndex + 23).Height = 90 * 20;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 1, 15));
|
||
ws.GetRow(rowIndex + 17).GetCell(1).SetCellValue(" 检验结论Conclusion:\n 共检验点,符合标准要求点,不符合标准要求点,具体检验部位详见示意图。\n Totally points are tested, where points are conforming and points are nonconforming. For specific test positions, see the sketch.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 1, 5));
|
||
ws.GetRow(rowIndex + 23).GetCell(1).SetCellValue("\n 试验人Tested by:\n\n\n 资格Qualification:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 6, 10));
|
||
ws.GetRow(rowIndex + 23).GetCell(6).SetCellValue("\n 审核人Reviewed by:\n\n\n 资格Qualification:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 11, 15));
|
||
ws.GetRow(rowIndex + 23).GetCell(11).SetCellValue(" 检测单位:(公章)\n\n Inspection Agency: (Official Seal)\n\n 报告日期Date: 年 月 日");
|
||
|
||
ws.GetRow(rowIndex + 17).GetCell(1).CellStyle = ws.GetRow(rowIndex + 23).GetCell(1).CellStyle = ws.GetRow(rowIndex + 23).GetCell(6).CellStyle = ws.GetRow(rowIndex + 23).GetCell(11).CellStyle = style2;
|
||
#endregion
|
||
|
||
rowIndex += 19;
|
||
}
|
||
|
||
ws.PrintSetup.Landscape = false;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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.VerticallyCenter = true;
|
||
//ws.HorizontallyCenter = true;
|
||
////打印边距设置 厘米/3
|
||
//ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
|
||
//ws.SetMargin(MarginType.LeftMargin, (double)2.9 / 3);
|
||
//ws.SetMargin(MarginType.TopMargin, (double)2.4 / 3);
|
||
//ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
|
||
|
||
////页眉页脚间距
|
||
//ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
//ws.SetMargin(MarginType.FooterMargin, 0);
|
||
}
|
||
|
||
//19-硬度检查报告SHT 3503-J130
|
||
private void template19(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
|
||
//模拟数据
|
||
string sql = @"select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 15 ? 1 : Math.Ceiling((float)(tbNum - 15) / 15) + 1;
|
||
|
||
int rowIndex = 0;
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 4, style, 1, 12, true);
|
||
ws.SetColumnWidth(0, 1 * 256);//A
|
||
ws.SetColumnWidth(1, 10 * 256);//B
|
||
ws.SetColumnWidth(2, 5 * 256);//C
|
||
ws.SetColumnWidth(3, 5 * 256);//D
|
||
ws.SetColumnWidth(4, 5 * 256);//E
|
||
ws.SetColumnWidth(5, 10 * 256);//F
|
||
ws.SetColumnWidth(6, 5 * 256);//G
|
||
ws.SetColumnWidth(7, 7 * 256);//H
|
||
ws.SetColumnWidth(8, 5 * 256);//I
|
||
ws.SetColumnWidth(9, 10 * 256);//J
|
||
ws.SetColumnWidth(10, 7 * 256);//K
|
||
ws.SetColumnWidth(11, 7 * 256);//L
|
||
ws.SetColumnWidth(12, 7 * 256);//M
|
||
|
||
ws.GetRow(rowIndex).HeightInPoints = 100f;
|
||
ws.GetRow(rowIndex + 1).HeightInPoints = 50f;
|
||
ws.GetRow(rowIndex + 2).HeightInPoints = 50f;
|
||
ws.GetRow(rowIndex + 3).HeightInPoints = 50f;
|
||
ws.GetRow(rowIndex + 4).HeightInPoints = 50f;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 1, 3));
|
||
ws.GetRow(rowIndex).GetCell(1).SetCellValue("SH/T 3503—J130");
|
||
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
style1.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 4, 9));
|
||
ws.GetRow(rowIndex).GetCell(4).CellStyle = style1;
|
||
ws.GetRow(rowIndex).GetCell(4).SetCellValue($"硬度检测报告\nHardness Test Report\n\n第 {num} 页 共 {pageNum} 页 Page of ");
|
||
|
||
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, false, false, "Arial Unicode MS");
|
||
style2.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 10, 12));
|
||
ws.GetRow(rowIndex).GetCell(10).CellStyle = style2;
|
||
ws.GetRow(rowIndex).GetCell(10).SetCellValue($"工程名称:{info?.projectName}\n\nProject Name:{info?.enProjectName}\n\n单位工程名称:{info?.workAreaName}\n\nUnit Name:{info?.enWorkAreaName}");
|
||
|
||
for (int i = 1; i < 5; i++)
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 2, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 6, 8));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 10, 12));
|
||
}
|
||
ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("委托单位\nEntrusted by");
|
||
ws.GetRow(rowIndex + 1).GetCell(5).SetCellValue("施工单位\nConstruction Contractor");
|
||
ws.GetRow(rowIndex + 1).GetCell(9).SetCellValue("报告编号\nReport No.");
|
||
ws.GetRow(rowIndex + 2).GetCell(1).SetCellValue("检件名称\nTest Piece Description");
|
||
ws.GetRow(rowIndex + 2).GetCell(5).SetCellValue("检测标准\nTest Criteria");
|
||
ws.GetRow(rowIndex + 2).GetCell(9).SetCellValue("验收标准\nMaterial Specification");
|
||
ws.GetRow(rowIndex + 3).GetCell(1).SetCellValue("检件规格\nTest Piece Specification");
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("检件材质\nTest Piece Material");
|
||
ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue("检测比例\nTest Percentage");
|
||
ws.GetRow(rowIndex + 4).GetCell(1).SetCellValue("检测方法\nTest Position No.");
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("热处理状态\nHT Status");
|
||
ws.GetRow(rowIndex + 4).GetCell(9).SetCellValue("设备型号\nEquipment Model");
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 5, rowIndex + 20, style, 1, 12, true);
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 15;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 15 : ((num - 2) * 15) + 15;
|
||
dEnd = ((num - 1) * 15) + 15;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
|
||
int j = 0;
|
||
for (int i = 5; i < 21; i++)
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 1, 2));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 3, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 5, 6));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 7, 8));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 11, 12));
|
||
if (i == 5)
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 41 * 20;
|
||
}
|
||
else
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 22 * 20;
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
var dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(3).SetCellValue(dr["PTP_ID"].ToString());
|
||
}
|
||
j++;
|
||
}
|
||
}
|
||
ws.GetRow(rowIndex + 5).GetCell(1).SetCellValue("检测部位编号\nTest Position No.");
|
||
ws.GetRow(rowIndex + 5).GetCell(3).SetCellValue("硬度值\nHardness Value");
|
||
ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue("检测部位编号\nTest Position No.");
|
||
ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("硬度值\nHardness Value");
|
||
ws.GetRow(rowIndex + 5).GetCell(9).SetCellValue("检测部位编号\nTest Position No.");
|
||
ws.GetRow(rowIndex + 5).GetCell(11).SetCellValue("硬度值\nHardness Value");
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 21, rowIndex + 22, style, 1, 12, true);
|
||
ws.GetRow(rowIndex + 21).HeightInPoints = 72f;
|
||
ws.GetRow(rowIndex + 22).HeightInPoints = 70f;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 21, rowIndex + 21, 1, 12));
|
||
ws.GetRow(rowIndex + 21).GetCell(1).SetCellValue("检测结论:\nConclusion:\n共检测点,符合标准要求点,不符合标准要求点,具体检测部位详见示意图。\nTotally points are tested, where points are conforming and points are nonconforming. For specific test positions, see the sketch.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 22, rowIndex + 22, 1, 4));
|
||
ws.GetRow(rowIndex + 22).GetCell(1).SetCellValue("\n 试验人Tested by:\n\n\n 资格Qualification:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 22, rowIndex + 22, 5, 8));
|
||
ws.GetRow(rowIndex + 22).GetCell(5).SetCellValue("\n 审核人Reviewed by:\n\n\n 资格Qualification:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 22, rowIndex + 22, 9, 12));
|
||
ws.GetRow(rowIndex + 22).GetCell(9).SetCellValue(" 检测单位:(公章)\n\n Inspection Agency: (Official Seal)\n\n 报告日期Date: 年 月 日");
|
||
|
||
ws.GetRow(rowIndex + 21).GetCell(1).CellStyle = ws.GetRow(rowIndex + 22).GetCell(1).CellStyle = ws.GetRow(rowIndex + 22).GetCell(5).CellStyle = ws.GetRow(rowIndex + 22).GetCell(9).CellStyle = style2;
|
||
|
||
#endregion
|
||
|
||
rowIndex += 23;
|
||
}
|
||
|
||
ws.PrintSetup.Landscape = false;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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.VerticallyCenter = true;
|
||
//ws.HorizontallyCenter = true;
|
||
////打印边距设置 厘米/3
|
||
//ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
|
||
//ws.SetMargin(MarginType.LeftMargin, (double)2.9 / 3);
|
||
//ws.SetMargin(MarginType.TopMargin, (double)2.4 / 3);
|
||
//ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
|
||
////页眉页脚间距
|
||
//ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
//ws.SetMargin(MarginType.FooterMargin, 0);
|
||
|
||
}
|
||
|
||
//21-管道焊接工作记录SHT 3503-J415
|
||
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,
|
||
a.PipelineCode,
|
||
e.WorkAreaCode,
|
||
a.WeldJointCode,
|
||
a.Specification,
|
||
a.Material1Code,
|
||
a.WeldingMethodCode,
|
||
a.WeldingDate,
|
||
a.WeldSilkCode,
|
||
a.WeldMatCode,
|
||
a.BackingWelderCode,
|
||
a.CoverWelderCode,
|
||
a.ProjectName,
|
||
(select top 1 EnProjectName from Base_Project where ProjectId=b.ProjectId ) as EnProjectName,
|
||
(select top 1 WorkAreaName from Project_WorkArea where WorkAreaId=c.WorkAreaId) as WorkAreaName,
|
||
(select top 1 EnWorkAreaName from Project_WorkArea where WorkAreaId=c.WorkAreaId) as EnWorkAreaName,
|
||
a.IsHotProess,(case a.IsHotProess when 1 then '是' else '否' end) as IsHotProessName,PrepareTemp,
|
||
WeldingLocationCode,a.WeldTypeCode,
|
||
(SELECT TOP 1 n.NDEReportNo FROM dbo.Batch_NDEItem n WHERE n.TrustBatchItemId=
|
||
(SELECT TOP 1 bt.TrustBatchItemId FROM dbo.Batch_BatchTrustItem bt WHERE bt.WeldJointId=a.WeldJointId)) AS NDEReportNo
|
||
FROM PTP_TestPackage as b inner join
|
||
PTP_PipelineList as c on b.PTP_ID=c.PTP_ID
|
||
inner join View_Pipeline_WeldJoint as a on c.PipelineId=a.PipelineId
|
||
left join Project_WorkArea as e on e.WorkAreaId=c.WorkAreaId
|
||
WHERE Is_hjName='是' and b.PTP_ID=@PTPID and a.projectId=@projectId
|
||
";
|
||
|
||
SqlParameter[] parms = {
|
||
new SqlParameter("@PTPID", this.tvControlItem.SelectedNodeID),
|
||
new SqlParameter("@projectId", this.CurrUser.LoginProjectId)
|
||
};
|
||
DataTable tb = SQLHelper.GetDataTableRunText(sql, parms);
|
||
|
||
|
||
int rowIndex = 0;
|
||
|
||
#region 列宽
|
||
|
||
ws.SetColumnWidth(0, 15 * 256);
|
||
ws.SetColumnWidth(1, 6 * 256);
|
||
ws.SetColumnWidth(2, 6 * 256);
|
||
ws.SetColumnWidth(3, 9 * 256);
|
||
ws.SetColumnWidth(4, 11 * 256);
|
||
ws.SetColumnWidth(5, 9 * 256);
|
||
ws.SetColumnWidth(6, 8 * 256);
|
||
ws.SetColumnWidth(7, 10 * 256);
|
||
ws.SetColumnWidth(8, 6 * 256);
|
||
ws.SetColumnWidth(9, 6 * 256);
|
||
ws.SetColumnWidth(10, 6 * 256);
|
||
ws.SetColumnWidth(11, 6 * 256);
|
||
ws.SetColumnWidth(12, 9 * 256);
|
||
ws.SetColumnWidth(13, 11 * 256);
|
||
ws.SetColumnWidth(14, 10 * 256);
|
||
|
||
#endregion
|
||
|
||
var headerStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 9, true, false);
|
||
|
||
var tbNum = tb.Rows.Count;
|
||
var pageNum =
|
||
tbNum < 12 ? 1
|
||
: Math.Ceiling((float)(tbNum - 12) / 12) + 1;
|
||
|
||
|
||
//循环页
|
||
for (int i = 1; i <= pageNum; i++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true, false);
|
||
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex, rowIndex + 5, style, 0, 14, 18);
|
||
//行0
|
||
CellRangeAddress region = new CellRangeAddress(rowIndex, rowIndex + 3, 0, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3503-J415-1");
|
||
ws.GetRow(rowIndex).GetCell(0).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true, true);
|
||
region = new CellRangeAddress(rowIndex, rowIndex + 3, 3, 10);
|
||
ws.AddMergedRegion(region);
|
||
string titleStr = i == 1 ? "管道焊接工作记录\r\nPiping Welding Record" : "管道焊接工作记录(续)\r\nPiping Welding Record";
|
||
ws.GetRow(rowIndex).GetCell(3).SetCellValue(titleStr);
|
||
ws.GetRow(rowIndex).GetCell(3).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 15, true, true);
|
||
region = new CellRangeAddress(rowIndex, rowIndex, 11, 14);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex).GetCell(11).SetCellValue($"工程名称:{info?.projectName}");
|
||
ws.GetRow(rowIndex).GetCell(11).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Justify, 9.5, true, false);
|
||
|
||
//行1
|
||
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 11, 14);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue($"Project Name:{info?.enProjectName}");
|
||
ws.GetRow(rowIndex + 1).GetCell(11).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Justify, 9.5, true, false);
|
||
|
||
//ws.GetRow(rowIndex + 1).Height = 25 * 20;
|
||
//ws.GetRow(rowIndex + 2).Height = 25 * 20;
|
||
//ws.GetRow(rowIndex + 3).Height = 25 * 20;
|
||
//ws.GetRow(rowIndex + 4).Height = 25 * 20;
|
||
//行2
|
||
region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 11, 14);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 2).GetCell(11).SetCellValue($"单位工程名称:{info?.workAreaName}");
|
||
ws.GetRow(rowIndex + 2).GetCell(11).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Justify, 10, true, false);
|
||
|
||
//行3
|
||
region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 11, 14);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 3).GetCell(11).SetCellValue($"Unit Name:{info?.enWorkAreaName}");
|
||
ws.GetRow(rowIndex + 3).GetCell(11).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Justify, 10, true, false);
|
||
|
||
//画线
|
||
RegionUtil.SetBorderBottom(0, new CellRangeAddress(rowIndex, rowIndex, 11, 14), ws);
|
||
RegionUtil.SetBorderTop(0, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 11, 14), ws);
|
||
RegionUtil.SetBorderBottom(0, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 11, 14), ws);
|
||
RegionUtil.SetBorderTop(0, new CellRangeAddress(rowIndex + 2, rowIndex + 2, 11, 14), ws);
|
||
RegionUtil.SetBorderBottom(0, new CellRangeAddress(rowIndex + 2, rowIndex + 2, 11, 14), ws);
|
||
RegionUtil.SetBorderTop(0, new CellRangeAddress(rowIndex + 3, rowIndex + 3, 11, 14), ws);
|
||
|
||
//行4行5
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 5, 0, 0);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("管道编号/单线号\r\nPiping No./Line No");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 5, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(1).SetCellValue("焊口编号\r\nWeld No.");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 5, 3, 3);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(3).SetCellValue("焊接形式\r\nWeld Type.");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 5, 4, 4);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(4).SetCellValue("焊工代号\r\nWelder's Stamp No.");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 5, 5, 5);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("规格mm\r\nSpecification\r\nmm");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 5, 6, 6);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(6).SetCellValue("材质\r\nMaterial");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 5, 7, 7);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("焊接位置\r\nWelding\r\nPosition");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 5, 8, 9);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(8).SetCellValue("焊接方法\r\nWelding Process");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 5, 10, 11);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(10).SetCellValue("焊材牌号\r\nWelding Material Designation");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 5, 12, 12);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(12).SetCellValue("实际预热温度℃\r\nActual Preheating Temperature ℃");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 5, 13, 13);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(13).SetCellValue("焊接日期\r\nWelding Date");
|
||
region = new CellRangeAddress(rowIndex + 4, rowIndex + 5, 14, 14);
|
||
ws.AddMergedRegion(region);
|
||
ws.GetRow(rowIndex + 4).GetCell(14).SetCellValue("无损检查报告\r\nNDE Report.");
|
||
|
||
ws.GetRow(rowIndex + 4).GetCell(0).CellStyle = ws.GetRow(rowIndex + 4).GetCell(1).CellStyle
|
||
= ws.GetRow(rowIndex + 4).GetCell(3).CellStyle = ws.GetRow(rowIndex + 4).GetCell(4).CellStyle
|
||
= ws.GetRow(rowIndex + 4).GetCell(5).CellStyle = ws.GetRow(rowIndex + 4).GetCell(6).CellStyle
|
||
= ws.GetRow(rowIndex + 4).GetCell(7).CellStyle = ws.GetRow(rowIndex + 4).GetCell(8).CellStyle
|
||
= ws.GetRow(rowIndex + 4).GetCell(10).CellStyle = ws.GetRow(rowIndex + 4).GetCell(12).CellStyle
|
||
= ws.GetRow(rowIndex + 4).GetCell(13).CellStyle = ws.GetRow(rowIndex + 4).GetCell(14).CellStyle
|
||
= headerStyle;
|
||
|
||
//ws.GetRow(rowIndex + 4).Height = 25 * 20;
|
||
//ws.GetRow(rowIndex + 5).Height = 25 * 20;
|
||
#endregion
|
||
|
||
#region 表格
|
||
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex + 6, rowIndex + 17, style, 0, 14, 18);
|
||
var dataTit = rowIndex + 6;
|
||
var tIndex = 5 + 12;
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (i == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 12;
|
||
}
|
||
else
|
||
{
|
||
dStart = i == 2 ? 12 : ((i - 2) * 12) + 12;
|
||
dEnd = ((i - 1) * 12) + 12;
|
||
}
|
||
|
||
//合并单元格
|
||
for (int hb = dataTit; hb <= rowIndex + tIndex; hb++)
|
||
{
|
||
region = new CellRangeAddress(hb, hb, 1, 2);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(hb, hb, 8, 9);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(hb, hb, 10, 11);
|
||
ws.AddMergedRegion(region);
|
||
}
|
||
|
||
//获取当前页数据
|
||
var pageTb = GetPageToTable(tb, dStart, dEnd);
|
||
int j = 0;
|
||
|
||
for (int k = 0; k < 12; k++)
|
||
{
|
||
int dataIndex = dataTit + j;
|
||
if (pageTb.Rows.Count > k)
|
||
{
|
||
DataRow dr = pageTb.Rows[k];
|
||
//管道编号/单线号
|
||
ws.GetRow(dataIndex).GetCell(0).SetCellValue(dr["PipelineCode"].ToString());
|
||
//焊口编号
|
||
ws.GetRow(dataIndex).GetCell(1).SetCellValue(dr["WeldJointCode"].ToString());
|
||
//焊接形式
|
||
ws.GetRow(dataIndex).GetCell(3).SetCellValue(dr["WeldTypeCode"].ToString());
|
||
//焊工代号
|
||
List<string> welderStr = new List<string>();
|
||
if (!string.IsNullOrWhiteSpace(dr["BackingWelderCode"].ToString()))
|
||
{
|
||
welderStr.Add(dr["BackingWelderCode"].ToString());
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dr["CoverWelderCode"].ToString()))
|
||
{
|
||
welderStr.Add(dr["CoverWelderCode"].ToString());
|
||
}
|
||
if (welderStr.Count > 0) welderStr = welderStr.GroupBy(x => x).Select(x => x.Key).ToList();
|
||
ws.GetRow(dataIndex).GetCell(4).SetCellValue(string.Join("/", welderStr));
|
||
//规格mm
|
||
ws.GetRow(dataIndex).GetCell(5).SetCellValue(dr["Specification"].ToString());
|
||
//材质
|
||
ws.GetRow(dataIndex).GetCell(6).SetCellValue(dr["Material1Code"].ToString());
|
||
//焊接位置
|
||
ws.GetRow(dataIndex).GetCell(7).SetCellValue(dr["WeldingLocationCode"].ToString());
|
||
//焊接方法
|
||
ws.GetRow(dataIndex).GetCell(8).SetCellValue(dr["WeldingMethodCode"].ToString());
|
||
//焊材牌号
|
||
List<string> silkMats = new List<string>();
|
||
if (!string.IsNullOrWhiteSpace(dr["WeldSilkCode"].ToString()))
|
||
{
|
||
silkMats.Add(dr["WeldSilkCode"].ToString());
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dr["WeldMatCode"].ToString()))
|
||
{
|
||
silkMats.Add(dr["WeldMatCode"].ToString());
|
||
}
|
||
if (silkMats.Count > 0) silkMats = silkMats.GroupBy(x => x).Select(x => x.Key).ToList();
|
||
ws.GetRow(dataIndex).GetCell(10).SetCellValue(string.Join("/", silkMats));
|
||
//实际预热温度
|
||
ws.GetRow(dataIndex).GetCell(12).SetCellValue(dr["PrepareTemp"].ToString());
|
||
//焊接日期
|
||
ws.GetRow(dataIndex).GetCell(13).SetCellValue(dr["WeldingDate"].ToString());
|
||
//无损检查报告
|
||
ws.GetRow(dataIndex).GetCell(14).SetCellValue(dr["NDEReportNo"].ToString());
|
||
}
|
||
j++;
|
||
ws.GetRow(dataIndex).Height = 20 * 20;
|
||
}
|
||
|
||
|
||
for (int k = rowIndex + 6; k <= rowIndex + 17; k++)
|
||
{
|
||
ws.GetRow(k).Height = 20 * 20;
|
||
}
|
||
rowIndex += tIndex;
|
||
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex + 1, rowIndex + 7, style, 0, 14, 25);
|
||
|
||
//合并单元格
|
||
for (int hb = rowIndex + 1; hb <= rowIndex + 7; hb++)
|
||
{
|
||
for (int c = 0; c <= 14; c++)
|
||
{
|
||
if (hb >= rowIndex + 1 && hb <= rowIndex + 6)
|
||
{
|
||
ws.GetRow(hb).GetCell(c).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true, false);
|
||
}
|
||
if (hb == rowIndex + 7)
|
||
{
|
||
ws.GetRow(hb).GetCell(c).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true, false);
|
||
}
|
||
}
|
||
region = new CellRangeAddress(hb, hb, 0, 3);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(hb, hb, 4, 9);
|
||
ws.AddMergedRegion(region);
|
||
region = new CellRangeAddress(hb, hb, 10, 14);
|
||
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:");
|
||
//行3
|
||
ws.GetRow(rowIndex + 4).GetCell(10).SetCellValue("质量检查员:\r\nQuality Inspector:");
|
||
//行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(4).SetCellValue("日期Date: 年 月 日");
|
||
ws.GetRow(rowIndex + 7).GetCell(10).SetCellValue("日期Date: 年 月 日");
|
||
|
||
#endregion
|
||
|
||
|
||
//style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true, false);
|
||
//ws = ExcelCreateRowNew(ws, hssfworkbook, rowIndex + 8, rowIndex + 9, style, 0, 14, 18);
|
||
rowIndex += 9;
|
||
ws.SetRowBreak(rowIndex - 1);
|
||
}
|
||
|
||
|
||
ws.PrintSetup.Landscape = true;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
ws.VerticallyCenter = true;
|
||
ws.HorizontallyCenter = true;
|
||
|
||
}
|
||
|
||
//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 (
|
||
select d.PipelineCode,
|
||
(select MaterialCode from Base_Material as m where d.MainMaterialId=m.MaterialId) as MaterialCode ,
|
||
d.Specification,
|
||
(select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId) as jointCount, --当前管线的焊口总数
|
||
( case when a.isAll=1 then
|
||
(select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId and joint.JointAttribute='固定F')
|
||
else
|
||
(select count(1) from Pipeline_WeldJoint as joint where joint.PipelineId=a.PipelineId and joint.JointAttribute='固定' and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0)
|
||
|
||
end ) as FjointCount, --当前管线的焊口的固定口总数
|
||
c.WelderCode, --焊工号
|
||
( case when a.isAll=1 then
|
||
(select count(1) from View_Pipeline_WeldJoint as vjoint where vjoint.PipelineId=a.PipelineId and vjoint.WelderCode=c.WelderCode)
|
||
else
|
||
(select count(1) from View_Pipeline_WeldJoint as vjoint where vjoint.PipelineId=a.PipelineId
|
||
and CHARINDEX(','+vjoint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and vjoint.WelderCode=c.WelderCode)
|
||
end ) as WelderNum,
|
||
(case when a.isAll=1 then
|
||
(select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
|
||
ON trust.TrustBatchItemId = nde.TrustBatchItemId
|
||
inner join View_Pipeline_WeldJoint as joint
|
||
ON joint.WeldJointId=trust.WeldJointId
|
||
where joint.PipelineId=a.PipelineId and joint.WelderCode=c.WelderCode)
|
||
else
|
||
(
|
||
select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
|
||
ON trust.TrustBatchItemId = nde.TrustBatchItemId
|
||
inner join View_Pipeline_WeldJoint as joint
|
||
ON joint.WeldJointId=trust.WeldJointId
|
||
where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.WelderCode=c.WelderCode
|
||
)
|
||
end
|
||
) as NdeNum, --检测口数量
|
||
(case when a.isAll=1 then
|
||
(select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
|
||
ON trust.TrustBatchItemId = nde.TrustBatchItemId
|
||
inner join View_Pipeline_WeldJoint as joint
|
||
ON joint.WeldJointId=trust.WeldJointId
|
||
where joint.PipelineId=a.PipelineId and joint.JointAttribute='固定F' and joint.WelderCode=c.WelderCode)
|
||
else
|
||
(
|
||
select count(1) from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
|
||
ON trust.TrustBatchItemId = nde.TrustBatchItemId
|
||
inner join View_Pipeline_WeldJoint as joint
|
||
ON joint.WeldJointId=trust.WeldJointId
|
||
where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.JointAttribute='固定F' and joint.WelderCode=c.WelderCode
|
||
)
|
||
end
|
||
) as FNdeNum , --检测固定口数量
|
||
(
|
||
case when a.isAll=1 then
|
||
(stuff((select ','+nde.NDEReportNo from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
|
||
ON trust.TrustBatchItemId = nde.TrustBatchItemId
|
||
inner join View_Pipeline_WeldJoint as joint
|
||
ON joint.WeldJointId=trust.WeldJointId
|
||
where joint.PipelineId=a.PipelineId and joint.WelderCode=c.WelderCode FOR xml path ('') ),1,1,''))
|
||
else
|
||
(stuff((select ','+nde.NDEReportNo from Batch_NDEItem as nde inner join Batch_BatchTrustItem as trust
|
||
ON trust.TrustBatchItemId = nde.TrustBatchItemId
|
||
inner join View_Pipeline_WeldJoint as joint
|
||
ON joint.WeldJointId=trust.WeldJointId
|
||
where joint.PipelineId=a.PipelineId and CHARINDEX(','+joint.WeldJointCode+',',','+a.WeldJonintCode+'')>0 and joint.WelderCode=c.WelderCode FOR xml path ( '' ) ),1,1,'') )
|
||
end) as NdeReportNo
|
||
from
|
||
PTP_PipelineList as a inner join
|
||
PTP_TestPackage as b on a.PTP_ID=b.PTP_ID
|
||
inner join View_Pipeline_WeldJoint as c
|
||
on c.PipelineId=a.PipelineId
|
||
inner join Pipeline_Pipeline as d
|
||
on c.PipelineId=d.PipelineId
|
||
where b.PTP_ID=@PTPID and b.ProjectId=@projectId
|
||
) as t
|
||
group by t.PipelineCode,t.MaterialCode,t.Specification,t.jointCount,t.FjointCount,t.WelderCode,t.WelderNum,t.NdeNum,t.FNdeNum,t.NdeReportNo";
|
||
|
||
SqlParameter[] parms =
|
||
{
|
||
new SqlParameter("@PTPID",this.tvControlItem.SelectedNodeID),
|
||
new SqlParameter("@projectId",this.CurrUser.LoginProjectId)
|
||
};
|
||
DataTable tb = SQLHelper.GetDataTableRunText(sql, parms);
|
||
var tbNum = tb.Rows.Count;
|
||
var pageNum =
|
||
tbNum < 8 ? 1
|
||
: Math.Ceiling((float)(tbNum - 8) / 8) + 1;
|
||
int rowIndex = 0;
|
||
for (int i = 1; i <= pageNum; i++)
|
||
{
|
||
#region 头部
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10.5, true, false, "宋体");
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 4, style, 0, 20, true);
|
||
|
||
//设置列宽
|
||
ws.SetColumnWidth(0, 9 * 256);//A
|
||
ws.SetColumnWidth(1, 4 * 256);//B
|
||
ws.SetColumnWidth(2, 9 * 256);//C
|
||
ws.SetColumnWidth(3, 5 * 256);//D
|
||
ws.SetColumnWidth(4, 5 * 256);//E
|
||
ws.SetColumnWidth(5, 4 * 256);//F
|
||
ws.SetColumnWidth(6, 4 * 256);//G
|
||
ws.SetColumnWidth(7, 7 * 256);//H
|
||
ws.SetColumnWidth(8, 6 * 256);//I
|
||
ws.SetColumnWidth(9, 6 * 256);//J
|
||
ws.SetColumnWidth(10, 5 * 256);//K
|
||
ws.SetColumnWidth(11, 7 * 256);//L
|
||
ws.SetColumnWidth(12, 6 * 256);//M
|
||
ws.SetColumnWidth(13, 5 * 256);//N
|
||
ws.SetColumnWidth(14, 4 * 256);//O
|
||
ws.SetColumnWidth(15, 4 * 256);//P
|
||
ws.SetColumnWidth(16, 4 * 256);//Q
|
||
ws.SetColumnWidth(17, 5 * 256);//R
|
||
ws.SetColumnWidth(18, 5 * 256);//S
|
||
ws.SetColumnWidth(19, 5 * 256);//T
|
||
ws.SetColumnWidth(20, 18 * 256);//U
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex + 3, 0, 2));
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3503-J412-1-2007");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 17));
|
||
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, NPOI.SS.UserModel.HorizontalAlignment.Center, 16, true, true);
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 2, 3, 17));
|
||
ws.GetRow(rowIndex + 1).GetCell(3).SetCellValue("Pipeline Welding Joints Radiographic Examination Rate Confirmation Form(I)");
|
||
ws.GetRow(rowIndex + 1).GetCell(3).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 18, 20));
|
||
ws.GetRow(rowIndex).GetCell(18).SetCellValue($"工程名称:{info?.projectName}");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 18, 20));
|
||
ws.GetRow(rowIndex + 1).GetCell(18).SetCellValue($"Project Name:{info?.enProjectName}");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 18, 20));
|
||
ws.GetRow(rowIndex + 2).GetCell(18).SetCellValue($"单元名称:{info?.workAreaName}");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 18, 20));
|
||
ws.GetRow(rowIndex + 3).GetCell(18).SetCellValue($"Unit Name:{info?.enWorkAreaName}");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 3, 17));
|
||
|
||
ws.GetRow(rowIndex).GetCell(18).CellStyle = ws.GetRow(rowIndex + 1).GetCell(18).CellStyle = ws.GetRow(rowIndex + 2).GetCell(18).CellStyle = ws.GetRow(rowIndex + 3).GetCell(18).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Left, 10.5, true, false);
|
||
RegionUtil.SetBorderBottom(0, new CellRangeAddress(rowIndex, rowIndex, 18, 20), ws);
|
||
RegionUtil.SetBorderTop(0, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 18, 20), ws);
|
||
RegionUtil.SetBorderBottom(0, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 18, 20), ws);
|
||
RegionUtil.SetBorderTop(0, new CellRangeAddress(rowIndex + 2, rowIndex + 2, 18, 20), ws);
|
||
RegionUtil.SetBorderBottom(0, new CellRangeAddress(rowIndex + 2, rowIndex + 2, 18, 20), ws);
|
||
RegionUtil.SetBorderTop(0, new CellRangeAddress(rowIndex + 3, rowIndex + 3, 18, 20), ws);
|
||
|
||
|
||
ws.GetRow(rowIndex + 3).GetCell(3).SetCellValue($"共 {pageNum} 页 第 {i} 页");
|
||
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("执行标准\r\nApplicable code");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 1, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 8, 15));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 16, 17));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 18, 20));
|
||
ws.GetRow(rowIndex + 4).GetCell(1).SetCellValue("NB/T47013.2-2015");
|
||
ws.GetRow(rowIndex + 4).GetCell(6).SetCellValue("检测方法\r\nExam. Method");
|
||
ws.GetRow(rowIndex + 4).GetCell(8).SetCellValue("射线检测\r\nRT");
|
||
ws.GetRow(rowIndex + 4).GetCell(16).SetCellValue("检测比例\r\nExam. Rate");
|
||
ws.GetRow(rowIndex + 4).GetCell(18).SetCellValue("5%");
|
||
|
||
ws.GetRow(rowIndex).Height = 27 * 20;
|
||
ws.GetRow(rowIndex + 1).Height = 27 * 20;
|
||
ws.GetRow(rowIndex + 2).Height = 15 * 20;
|
||
ws.GetRow(rowIndex + 3).Height = 20 * 20;
|
||
ws.GetRow(rowIndex + 4).Height = 40 * 20;
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 5, rowIndex + 6, style, 0, 20, true);
|
||
ws.GetRow(rowIndex + 5).Height = 25 * 20;
|
||
ws.GetRow(rowIndex + 6).Height = 30 * 20;
|
||
var dataTit = rowIndex + 7;
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (i == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 8;
|
||
}
|
||
else
|
||
{
|
||
dStart = i == 2 ? 8 : ((i - 2) * 8) + 8;
|
||
dEnd = ((i - 1) * 8) + 8;
|
||
|
||
}
|
||
//这里创建行数据 17-16
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 7, rowIndex + 16, style, 0, 20, true);
|
||
|
||
#region 设置表头部分
|
||
//设置表头部分
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 6, 0, 1));
|
||
ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("管道编号\r\nPipeline No.");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 6, 2, 2));
|
||
ws.GetRow(rowIndex + 5).GetCell(2).SetCellValue("材质\r\nMaterial");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 3, 4));
|
||
ws.GetRow(rowIndex + 5).GetCell(3).SetCellValue("规 格/Size");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 3, 4));
|
||
ws.GetRow(rowIndex + 6).GetCell(3).SetCellValue("mm");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 5, 8));
|
||
ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue("管道焊接接头\r\nWelding Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 9, 12));
|
||
ws.GetRow(rowIndex + 5).GetCell(9).SetCellValue("施焊焊工\r\nWelder");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 13, 16));
|
||
ws.GetRow(rowIndex + 5).GetCell(13).SetCellValue("检测焊接接头\r\nExanined Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 17, 19));
|
||
ws.GetRow(rowIndex + 5).GetCell(17).SetCellValue("实际检测比例");
|
||
|
||
ws.GetRow(rowIndex + 5).GetCell(20).SetCellValue("检测报告编号");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 6));
|
||
ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue("总数\r\nTotal");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 7, 8));
|
||
ws.GetRow(rowIndex + 6).GetCell(7).SetCellValue("固定口数\r\nField Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 9, 10));
|
||
ws.GetRow(rowIndex + 6).GetCell(9).SetCellValue("焊工代号\r\nWelder No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 11, 12));
|
||
ws.GetRow(rowIndex + 6).GetCell(11).SetCellValue("施焊数量\r\nWelded Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 13, 14));
|
||
ws.GetRow(rowIndex + 6).GetCell(13).SetCellValue("总数\r\nTotal Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 15, 16));
|
||
ws.GetRow(rowIndex + 6).GetCell(15).SetCellValue("固定口数\r\nField Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 17, 19));
|
||
ws.GetRow(rowIndex + 6).GetCell(17).SetCellValue("Actual exam. Rate");
|
||
|
||
ws.GetRow(rowIndex + 6).GetCell(20).SetCellValue("Examination Report No.");
|
||
RegionUtil.SetBorderBottom(0, new CellRangeAddress(rowIndex + 5, rowIndex + 5, 17, 20), ws);
|
||
RegionUtil.SetBorderTop(0, new CellRangeAddress(rowIndex + 6, rowIndex + 6, 17, 20), ws);
|
||
|
||
#endregion
|
||
|
||
for (int k = rowIndex + 7; k < rowIndex + 16; k++)
|
||
{
|
||
ws.GetRow(k).Height = 18 * 20;
|
||
//小计行
|
||
if (k == rowIndex + 15)
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(k, k, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(k, k, 3, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(k, k, 5, 6));
|
||
ws.AddMergedRegion(new CellRangeAddress(k, k, 7, 8));
|
||
}
|
||
ws.AddMergedRegion(new CellRangeAddress(k, k, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(k, k, 11, 12));
|
||
ws.AddMergedRegion(new CellRangeAddress(k, k, 13, 14));
|
||
ws.AddMergedRegion(new CellRangeAddress(k, k, 15, 16));
|
||
ws.AddMergedRegion(new CellRangeAddress(k, k, 17, 19));
|
||
}
|
||
|
||
//获取当前页数据
|
||
var pageTb = GetPageToTable(tb, dStart, dEnd);
|
||
int j = 0;
|
||
|
||
var pagelist = DataTableEx.ToList<template22Dto>(pageTb);
|
||
|
||
int oneNum = 1;
|
||
int twoNum = 1;
|
||
int threeNum = 1;
|
||
int fourNum = 1;
|
||
int fiveNum = 1;
|
||
for (int k = 0; k < 8; k++)
|
||
{
|
||
int dataIndex = dataTit + j;
|
||
if (pageTb.Rows.Count > k)
|
||
{
|
||
DataRow dr = pageTb.Rows[k];
|
||
ws.GetRow(dataIndex).GetCell(0).SetCellValue(dr["PipelineCode"].ToString());
|
||
var PipelineCodeNum = pagelist.Count(x => x.PipelineCode == dr["PipelineCode"].ToString());
|
||
if (PipelineCodeNum > 1)
|
||
{
|
||
if (oneNum == 1)
|
||
{
|
||
oneNum += PipelineCodeNum;
|
||
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex + PipelineCodeNum - 1, 0, 1));
|
||
}
|
||
oneNum -= 1;
|
||
}
|
||
else
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 0, 1));
|
||
}
|
||
|
||
|
||
ws.GetRow(dataIndex).GetCell(2).SetCellValue(dr["MaterialCode"].ToString());
|
||
var MaterialCodeNum = pagelist.Count(x => x.PipelineCode == dr["PipelineCode"].ToString() && x.MaterialCode == dr["MaterialCode"].ToString());
|
||
if (MaterialCodeNum > 1)
|
||
{
|
||
if (twoNum == 1)
|
||
{
|
||
twoNum += MaterialCodeNum;
|
||
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex + PipelineCodeNum - 1, 2, 2));
|
||
}
|
||
twoNum -= 1;
|
||
}
|
||
int SpecificationNum = 0;
|
||
ws.GetRow(dataIndex).GetCell(3).SetCellValue(dr["Specification"].ToString());
|
||
if (string.IsNullOrEmpty(dr["Specification"].ToString()))
|
||
{
|
||
SpecificationNum = pagelist.Count(x => x.PipelineCode == dr["PipelineCode"].ToString());
|
||
}
|
||
else
|
||
{
|
||
SpecificationNum = pagelist.Count(x => x.PipelineCode == dr["PipelineCode"].ToString() && x.Specification == dr["Specification"].ToString());
|
||
}
|
||
if (SpecificationNum > 1)
|
||
{
|
||
if (threeNum == 1)
|
||
{
|
||
threeNum += SpecificationNum;
|
||
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex + PipelineCodeNum - 1, 3, 4));
|
||
}
|
||
threeNum -= 1;
|
||
}
|
||
else
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 3, 4));
|
||
}
|
||
|
||
ws.GetRow(dataIndex).GetCell(5).SetCellValue(dr["jointCount"].ToString());
|
||
var jointCountNum = pagelist.Count(x => x.PipelineCode == dr["PipelineCode"].ToString() && x.jointCount == dr["jointCount"].ToString());
|
||
if (jointCountNum > 1)
|
||
{
|
||
if (fourNum == 1)
|
||
{
|
||
fourNum += jointCountNum;
|
||
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex + PipelineCodeNum - 1, 5, 6));
|
||
}
|
||
fourNum -= 1;
|
||
}
|
||
else
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 5, 6));
|
||
}
|
||
|
||
ws.GetRow(dataIndex).GetCell(7).SetCellValue(dr["FjointCount"].ToString());
|
||
var FjointCountNum = pagelist.Count(x => x.PipelineCode == dr["PipelineCode"].ToString() && x.FjointCount == dr["FjointCount"].ToString());
|
||
if (FjointCountNum > 1)
|
||
{
|
||
if (fiveNum == 1)
|
||
{
|
||
fiveNum += FjointCountNum;
|
||
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex + PipelineCodeNum - 1, 7, 8));
|
||
}
|
||
fiveNum -= 1;
|
||
}
|
||
else
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 7, 8));
|
||
}
|
||
|
||
|
||
ws.GetRow(dataIndex).GetCell(9).SetCellValue(dr["WelderCode"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(11).SetCellValue(dr["WelderNum"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(13).SetCellValue(dr["NdeNum"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(15).SetCellValue(dr["FNdeNum"].ToString());
|
||
string a = string.IsNullOrEmpty(dr["NdeNum"].ToString()) ? "0" : dr["NdeNum"].ToString();
|
||
string b = string.IsNullOrEmpty(dr["WelderNum"].ToString()) ? "0" : dr["WelderNum"].ToString();
|
||
|
||
if (b == "0")
|
||
{
|
||
ws.GetRow(dataIndex).GetCell(17).SetCellValue("0%");
|
||
}
|
||
else
|
||
{
|
||
decimal rate = Math.Round((decimal.Parse(a) / decimal.Parse(b)), 2);
|
||
ws.GetRow(dataIndex).GetCell(17).SetCellValue($"{rate * 100}%");
|
||
}
|
||
ws.GetRow(dataIndex).GetCell(20).SetCellValue(dr["NdeReportNo"].ToString());
|
||
}
|
||
else
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 3, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 5, 6));
|
||
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 7, 8));
|
||
}
|
||
j++;
|
||
}
|
||
|
||
ws.GetRow(rowIndex + 15).GetCell(0).SetCellValue("小计\r\nTotal");
|
||
ws.GetRow(rowIndex + 15).Height = 25 * 20;
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
ws.GetRow(rowIndex + 16).GetCell(0).SetCellValue("备注\r\nRemark");
|
||
ws.GetRow(rowIndex + 16).GetCell(1).SetCellValue("焊口位置与检测焊口见管道单线图与无损检测报告。\r\nPlease refer to Pipeline Iso-drawing and NDE Report for joints position and examined joints.");
|
||
ws.GetRow(rowIndex + 16).GetCell(1).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Left, 10.5, true, false);
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 1, 20));
|
||
ws.GetRow(rowIndex + 16).Height = 25 * 20;
|
||
|
||
|
||
style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Left, 10.5, true, false);
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10.5, true, false);
|
||
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Bottom, NPOI.SS.UserModel.HorizontalAlignment.Left, 10.5, true, false);
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 17, rowIndex + 23, style, 0, 20, true);
|
||
|
||
ws.GetRow(rowIndex + 17).GetCell(20).CellStyle = style1;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 0, 3));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 4, 9));
|
||
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");
|
||
ws.GetRow(rowIndex + 17).GetCell(17).SetCellValue("施 工 单 位\r\nConstruction Company");
|
||
ws.GetRow(rowIndex + 17).GetCell(0).CellStyle = ws.GetRow(rowIndex + 17).GetCell(4).CellStyle = ws.GetRow(rowIndex + 17).GetCell(10).CellStyle = ws.GetRow(rowIndex + 17).GetCell(17).CellStyle = style1;
|
||
ws.GetRow(rowIndex + 17).Height = 28 * 20;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 18, rowIndex + 18, 0, 3));
|
||
ws.GetRow(rowIndex + 18).GetCell(0).SetCellValue("专业工程师\r\nDiscipline Engineer:");
|
||
ws.GetRow(rowIndex + 18).Height = 25 * 20;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 18, rowIndex + 18, 4, 9));
|
||
ws.GetRow(rowIndex + 18).GetCell(4).SetCellValue("专业工程师\r\nDiscipline Engineer:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 18, rowIndex + 18, 10, 16));
|
||
ws.GetRow(rowIndex + 18).GetCell(10).SetCellValue("专业工程师\r\nDiscipline Engineer:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 18, rowIndex + 18, 17, 20));
|
||
ws.GetRow(rowIndex + 18).GetCell(17).SetCellValue("专业工程师\r\nDiscipline Engineer:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 20, rowIndex + 20, 17, 20));
|
||
ws.GetRow(rowIndex + 20).GetCell(17).SetCellValue("质量检查员:\r\nQuality Inspector:");
|
||
ws.GetRow(rowIndex + 20).Height = 25 * 20;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 22, rowIndex + 22, 17, 20));
|
||
ws.GetRow(rowIndex + 22).GetCell(17).SetCellValue("制表:\r\nPrepared:");
|
||
ws.GetRow(rowIndex + 22).Height = 25 * 20;
|
||
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 0, 3));
|
||
ws.GetRow(rowIndex + 23).GetCell(0).SetCellValue("日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 4, 9));
|
||
ws.GetRow(rowIndex + 23).GetCell(4).SetCellValue("日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 10, 16));
|
||
ws.GetRow(rowIndex + 23).GetCell(10).SetCellValue("日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 17, 20));
|
||
ws.GetRow(rowIndex + 23).GetCell(17).SetCellValue("日期Date: 年 月 日");
|
||
ws.GetRow(rowIndex + 23).Height = 25 * 20;
|
||
|
||
ws.GetRow(rowIndex + 23).GetCell(0).CellStyle = ws.GetRow(rowIndex + 23).GetCell(4).CellStyle = ws.GetRow(rowIndex + 23).GetCell(10).CellStyle = ws.GetRow(rowIndex + 23).GetCell(17).CellStyle = style2;
|
||
|
||
ws.GetRow(rowIndex + 19).Height = 14 * 20;
|
||
ws.GetRow(rowIndex + 20).Height = 14 * 20;
|
||
ws.GetRow(rowIndex + 21).Height = 14 * 20;
|
||
ws.GetRow(rowIndex + 22).Height = 25 * 20;
|
||
RegionUtil.SetBorderLeft(1, new CellRangeAddress(rowIndex + 18, rowIndex + 23, 0, 0), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 17, rowIndex + 17, 0, 20), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 18, rowIndex + 22, 3, 3), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 18, rowIndex + 22, 9, 9), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 18, rowIndex + 22, 16, 16), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 18, rowIndex + 22, 20, 20), ws);
|
||
RegionUtil.SetBorderTop(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 0, 20), ws);
|
||
RegionUtil.SetBorderLeft(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 0, 0), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 20, 20), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 0, 20), ws);
|
||
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 3, 3), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 9, 9), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 16, 16), ws);
|
||
|
||
#endregion
|
||
|
||
rowIndex = rowIndex + 24;
|
||
}
|
||
|
||
ws.PrintSetup.Landscape = true;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
ws.VerticallyCenter = true;
|
||
ws.HorizontallyCenter = true;
|
||
|
||
|
||
}
|
||
|
||
//23-TP-09-超声&PAUT&TOFD检测比例确认表
|
||
private void template23(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
|
||
//模拟数据
|
||
string sql = @"select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 8 ? 1 : Math.Ceiling((float)(tbNum - 8) / 8) + 1;
|
||
|
||
int rowIndex = 0;
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
#region 头部
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 11, true, false, "宋体");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 5, style, 0, 20, true);
|
||
|
||
for (int i = 0; i < 21; i++)
|
||
{
|
||
ws.GetRow(rowIndex).GetCell(i).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10);
|
||
}
|
||
//设置列宽
|
||
ws.SetColumnWidth(0, 10 * 256);//A
|
||
ws.SetColumnWidth(1, 4 * 256);//B
|
||
ws.SetColumnWidth(2, 7 * 256);//C
|
||
ws.SetColumnWidth(3, 5 * 256);//D
|
||
ws.SetColumnWidth(4, 5 * 256);//E
|
||
ws.SetColumnWidth(5, 5 * 256);//F
|
||
ws.SetColumnWidth(6, 5 * 256);//G
|
||
ws.SetColumnWidth(7, 6 * 256);//H
|
||
ws.SetColumnWidth(8, 7 * 256);//I
|
||
ws.SetColumnWidth(9, 6 * 256);//J
|
||
ws.SetColumnWidth(10, 4 * 256);//K
|
||
ws.SetColumnWidth(11, 6 * 256);//L
|
||
ws.SetColumnWidth(12, 4 * 256);//M
|
||
ws.SetColumnWidth(13, 4 * 256);//N
|
||
ws.SetColumnWidth(14, 6 * 256);//O
|
||
ws.SetColumnWidth(15, 6 * 256);//P
|
||
ws.SetColumnWidth(16, 5 * 256);//Q
|
||
ws.SetColumnWidth(17, 6 * 256);//R
|
||
ws.SetColumnWidth(18, 5 * 256);//S
|
||
ws.SetColumnWidth(19, 6 * 256);//T
|
||
ws.SetColumnWidth(20, 13 * 256);//U
|
||
|
||
|
||
|
||
ws.GetRow(rowIndex).GetCell(20).SetCellValue("Form No. TP-09");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 4, 0, 2));
|
||
ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("SH/T 3503-J412-1-2007");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 3, 17));
|
||
ws.GetRow(rowIndex + 1).GetCell(3).SetCellValue("管道焊接接头超声/PAUT/TOFD检测比例确认表(一)");
|
||
ws.GetRow(rowIndex + 1).GetCell(3).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 16, true, true);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 3, 3, 17));
|
||
ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue("Pipeline Welding Joints Ultrasonic Examination/PAUT/TOFD Rate Confirmation Form(I)");
|
||
ws.GetRow(rowIndex + 2).GetCell(3).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 16, true, true);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 4, 18, 20));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 3, 17));
|
||
|
||
|
||
ws.GetRow(rowIndex + 1).GetCell(18).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, true, false);
|
||
ws.GetRow(rowIndex + 1).GetCell(18).SetCellValue($"工程名称:{info?.projectName}\nProject Name:{info?.enProjectName}\n单元名称:{info?.workAreaName}\nUnit Name:{info?.enWorkAreaName}");
|
||
|
||
ws.GetRow(rowIndex + 4).GetCell(3).SetCellValue($"共 {pageNum} 页 第 {num} 页");
|
||
|
||
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 1, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 8, 15));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 16, 17));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 18, 20));
|
||
ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("执行标准\r\nApplicable code");
|
||
ws.GetRow(rowIndex + 5).GetCell(1).SetCellValue("NB/T47013.3-2015");
|
||
ws.GetRow(rowIndex + 5).GetCell(6).SetCellValue("检测方法\r\nExam. Method");
|
||
ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue("超声检测\r\nUT");
|
||
ws.GetRow(rowIndex + 5).GetCell(16).SetCellValue("检测比例\r\nExam. Rate");
|
||
ws.GetRow(rowIndex + 5).GetCell(18).SetCellValue("95%");
|
||
|
||
|
||
//表头部分设置行高
|
||
ws.GetRow(rowIndex).Height = 13 * 20;
|
||
ws.GetRow(rowIndex + 1).Height = 24 * 20;
|
||
ws.GetRow(rowIndex + 2).Height = 24 * 20;
|
||
ws.GetRow(rowIndex + 3).Height = 24 * 20;
|
||
ws.GetRow(rowIndex + 4).Height = 15 * 20;
|
||
ws.GetRow(rowIndex + 5).Height = 40 * 20;
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 6, rowIndex + 7, style, 0, 20, true);
|
||
|
||
ws.GetRow(rowIndex + 6).Height = 25 * 20;
|
||
ws.GetRow(rowIndex + 7).Height = 40 * 20;
|
||
|
||
|
||
//设置表头部分
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 7, 0, 1));
|
||
ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("管道编号\r\nPipeline No.");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 7, 2, 2));
|
||
ws.GetRow(rowIndex + 6).GetCell(2).SetCellValue("材质\r\nMaterial");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 3, 4));
|
||
ws.GetRow(rowIndex + 6).GetCell(3).SetCellValue("规 格/Size");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 3, 4));
|
||
ws.GetRow(rowIndex + 7).GetCell(3).SetCellValue("mm");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 8));
|
||
ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue("管道焊接接头\r\nWelding Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 9, 12));
|
||
ws.GetRow(rowIndex + 6).GetCell(9).SetCellValue("施焊焊工\r\nWelder");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 13, 16));
|
||
ws.GetRow(rowIndex + 6).GetCell(13).SetCellValue("检测焊接接头\r\nExanined Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 17, 19));
|
||
ws.GetRow(rowIndex + 6).GetCell(17).SetCellValue("实际检测比例");
|
||
|
||
ws.GetRow(rowIndex + 6).GetCell(20).SetCellValue("检测报告编号");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 5, 6));
|
||
ws.GetRow(rowIndex + 7).GetCell(5).SetCellValue("总数\r\nTotal");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 7, 8));
|
||
ws.GetRow(rowIndex + 7).GetCell(7).SetCellValue("固定口数\r\nField Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 9, 10));
|
||
ws.GetRow(rowIndex + 7).GetCell(9).SetCellValue("焊工代号\r\nWelder No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 11, 12));
|
||
ws.GetRow(rowIndex + 7).GetCell(11).SetCellValue("施焊数量\r\nWelded Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 13, 14));
|
||
ws.GetRow(rowIndex + 7).GetCell(13).SetCellValue("总数\r\nTotal Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 15, 16));
|
||
ws.GetRow(rowIndex + 7).GetCell(15).SetCellValue("固定口数\r\nField Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 17, 19));
|
||
ws.GetRow(rowIndex + 7).GetCell(17).SetCellValue("Actual exam. Rate");
|
||
|
||
ws.GetRow(rowIndex + 7).GetCell(20).SetCellValue("Examination Report No.");
|
||
|
||
//这里创建行数据
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 8, rowIndex + 23, style, 0, 20, true);
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 8;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 8 : ((num - 2) * 8) + 8;
|
||
dEnd = ((num - 1) * 8) + 8;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int j = 0;
|
||
for (int i = 8; i < 16; i++)
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 17 * 20;
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
var dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(0).SetCellValue("模拟数据");
|
||
}
|
||
j++;
|
||
}
|
||
|
||
//这里循环数据
|
||
ws.GetRow(rowIndex + 16).GetCell(0).SetCellValue("小计\r\nTotal");
|
||
ws.GetRow(rowIndex + 17).GetCell(0).SetCellValue("备注\r\nRemark");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 1, 20));
|
||
ws.GetRow(rowIndex + 17).GetCell(1).SetCellValue("焊口位置与检测焊口见管道单线图与无损检测报告。\r\nPlease refer to Pipeline Iso-drawing and NDE Report for joints position and examined joints.");
|
||
ws.GetRow(rowIndex + 17).GetCell(1).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, true, false);
|
||
ws.GetRow(rowIndex + 16).Height = 28 * 20;
|
||
ws.GetRow(rowIndex + 17).Height = 28 * 20;
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Left, 11, true, false);
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 23, rowIndex + 25, style, 0, 20, true);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 0, 3));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 4, 9));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 10, 16));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 17, 20));
|
||
|
||
ws.GetRow(rowIndex + 23).GetCell(0).SetCellValue("建设/监理单位\r\nOwner/Supervision Contractor");
|
||
ws.GetRow(rowIndex + 23).GetCell(4).SetCellValue("总承包单位\r\nGeneral Contractor");
|
||
ws.GetRow(rowIndex + 23).GetCell(10).SetCellValue("检 测 单 位\r\nExamination Contractor");
|
||
ws.GetRow(rowIndex + 23).GetCell(17).SetCellValue("施 工 单 位\r\nConstruction Company");
|
||
ws.GetRow(rowIndex + 23).Height = 28 * 20;
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 11, true, false);
|
||
ws.GetRow(rowIndex + 23).GetCell(0).CellStyle = ws.GetRow(rowIndex + 23).GetCell(4).CellStyle = ws.GetRow(rowIndex + 23).GetCell(10).CellStyle = ws.GetRow(rowIndex + 23).GetCell(17).CellStyle = style1;
|
||
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 19, rowIndex + 19, 0, 3));
|
||
ws.GetRow(rowIndex + 19).GetCell(0).SetCellValue("专业工程师\r\nDiscipline Engineer:");
|
||
ws.GetRow(rowIndex + 19).Height = 28 * 20;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 19, rowIndex + 19, 4, 9));
|
||
ws.GetRow(rowIndex + 19).GetCell(4).SetCellValue("专业工程师\r\nDiscipline Engineer:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 19, rowIndex + 19, 10, 16));
|
||
ws.GetRow(rowIndex + 19).GetCell(10).SetCellValue("专业工程师\r\nDiscipline Engineer:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 19, rowIndex + 19, 17, 20));
|
||
ws.GetRow(rowIndex + 19).GetCell(17).SetCellValue("专业工程师\r\nDiscipline Engineer:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 21, rowIndex + 21, 17, 20));
|
||
ws.GetRow(rowIndex + 21).GetCell(17).SetCellValue("质量检查员:\r\nQuality Inspector:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 17, 20));
|
||
ws.GetRow(rowIndex + 23).GetCell(17).SetCellValue("制表:\r\nPrepared:");
|
||
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 25, rowIndex + 25, 0, 3));
|
||
ws.GetRow(rowIndex + 25).GetCell(0).SetCellValue("日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 25, rowIndex + 25, 4, 9));
|
||
ws.GetRow(rowIndex + 25).GetCell(4).SetCellValue("日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 25, rowIndex + 25, 10, 16));
|
||
ws.GetRow(rowIndex + 25).GetCell(10).SetCellValue("日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 25, rowIndex + 25, 17, 20));
|
||
ws.GetRow(rowIndex + 25).GetCell(17).SetCellValue("日期Date: 年 月 日");
|
||
|
||
|
||
ws.GetRow(rowIndex + 20).Height = 3 * 20;
|
||
ws.GetRow(rowIndex + 21).Height = 28 * 20;
|
||
ws.GetRow(rowIndex + 22).Height = 3 * 20;
|
||
ws.GetRow(rowIndex + 23).Height = 28 * 20;
|
||
ws.GetRow(rowIndex + 24).Height = 3 * 20;
|
||
ws.GetRow(rowIndex + 25).Height = 28 * 20;
|
||
|
||
RegionUtil.SetBorderTop(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 0, 20), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 0, 20), ws);
|
||
RegionUtil.SetBorderLeft(1, new CellRangeAddress(rowIndex + 23, rowIndex + 25, 0, 0), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 23, rowIndex + 25, 20, 20), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 25, rowIndex + 25, 0, 20), ws);
|
||
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 23, rowIndex + 25, 3, 3), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 23, rowIndex + 25, 9, 9), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 23, rowIndex + 25, 16, 16), ws);
|
||
|
||
#endregion
|
||
|
||
rowIndex = rowIndex + 26;
|
||
}
|
||
|
||
ws.PrintSetup.Landscape = true;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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.HorizontallyCenter = true;
|
||
//ws.VerticallyCenter = 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);
|
||
}
|
||
|
||
//24-TP-10-渗透&MT检测比例确认表
|
||
private void template24(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
|
||
//模拟数据
|
||
string sql = @"select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 8 ? 1 : Math.Ceiling((float)(tbNum - 8) / 8) + 1;
|
||
|
||
int rowIndex = 0;
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Right, 9, true, false, "Arial Unicode MS");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex, style1, 0, 20, true);
|
||
|
||
//设置行宽度
|
||
ws.SetColumnWidth(0, 13 * 256);//A
|
||
ws.SetColumnWidth(1, 2 * 256);//B
|
||
ws.SetColumnWidth(2, 7 * 256);//C
|
||
ws.SetColumnWidth(3, 5 * 256);//D
|
||
ws.SetColumnWidth(4, 4 * 256);//E
|
||
ws.SetColumnWidth(5, 5 * 256);//F
|
||
ws.SetColumnWidth(6, 6 * 256);//G
|
||
ws.SetColumnWidth(7, 6 * 256);//H
|
||
ws.SetColumnWidth(8, 6 * 256);//I
|
||
ws.SetColumnWidth(9, 5 * 256);//J
|
||
ws.SetColumnWidth(10, 5 * 256);//K
|
||
ws.SetColumnWidth(11, 5 * 256);//L
|
||
ws.SetColumnWidth(12, 7 * 256);//M
|
||
ws.SetColumnWidth(13, 5 * 256);//N
|
||
ws.SetColumnWidth(14, 5 * 256);//O
|
||
ws.SetColumnWidth(15, 5 * 256);//P
|
||
ws.SetColumnWidth(16, 5 * 256);//Q
|
||
ws.SetColumnWidth(17, 6 * 256);//R
|
||
ws.SetColumnWidth(18, 6 * 256);//S
|
||
ws.SetColumnWidth(19, 6 * 256);//T
|
||
ws.SetColumnWidth(20, 13 * 256);//U
|
||
|
||
//设置行高度
|
||
ws.GetRow(rowIndex).HeightInPoints = 10f;
|
||
ws.GetRow(rowIndex).GetCell(20).CellStyle = style1;
|
||
ws.GetRow(rowIndex).GetCell(20).SetCellValue("Form No. TP-10");
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 2, style, 0, 20, true);
|
||
//设置行高度
|
||
ws.GetRow(rowIndex + 1).HeightInPoints = 90f;
|
||
ws.GetRow(rowIndex + 2).HeightInPoints = 30f;
|
||
|
||
//合并单元格和填充文本
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 0, 2));
|
||
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("");
|
||
|
||
var style3 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 13, true, true, "Arial Unicode MS");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 3, 17));
|
||
ws.GetRow(rowIndex + 1).GetCell(3).CellStyle = style3;
|
||
ws.GetRow(rowIndex + 1).GetCell(3).SetCellValue($"管道焊接接头渗透/磁粉检测比例确认表(一)\nPipeline Welding Joints Penetrant/Magnetic Examination Rate Confirmation Form(I)\n共 {pageNum} 页 第 {num} 页");
|
||
|
||
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 9, true, false, "Arial Unicode MS");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 18, 20));
|
||
ws.GetRow(rowIndex + 1).GetCell(18).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 1).GetCell(18).SetCellValue($"\n工程名称:{info?.projectName}\n Project Name:{info?.enProjectName}\n 单元名称:{info?.workAreaName}\n Unit Name:{info?.enWorkAreaName}");
|
||
|
||
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("执行标准\nApplicable code");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 1, 5));
|
||
ws.GetRow(rowIndex + 2).GetCell(1).SetCellValue("NB/T47013.3-2015");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 6, 7));
|
||
ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("检测方法\nExam. Method");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 15));
|
||
ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("渗透检测\nPT");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 16, 17));
|
||
ws.GetRow(rowIndex + 2).GetCell(16).SetCellValue("检测比例\nExam. Rate");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 18, 20));
|
||
ws.GetRow(rowIndex + 2).GetCell(18).SetCellValue("95%");
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 3, rowIndex + 13, style, 0, 20, true);
|
||
//设置高度和合并列填充文本
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 4, 0, 1));
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("管道编号\nPipeline No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 4, 2, 2));
|
||
ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue("材质\nMaterial");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 4, 3, 4));
|
||
ws.GetRow(rowIndex + 3).GetCell(3).SetCellValue("规 格/Size\n mm");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 8));
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("管道焊接接头\nWelding Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 9, 12));
|
||
ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue("施焊焊工\nWelder");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 13, 16));
|
||
ws.GetRow(rowIndex + 3).GetCell(13).SetCellValue("检测焊接接头\nExanined Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 6));
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("总数\nTotal");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 7, 8));
|
||
ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("固定口数\nField Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 9, 10));
|
||
ws.GetRow(rowIndex + 4).GetCell(9).SetCellValue("焊工代号\nWelder No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 11, 12));
|
||
ws.GetRow(rowIndex + 4).GetCell(11).SetCellValue("施焊数量\nWelded Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 13, 14));
|
||
ws.GetRow(rowIndex + 4).GetCell(13).SetCellValue("总数\nTotal Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 15, 16));
|
||
ws.GetRow(rowIndex + 4).GetCell(15).SetCellValue("固定口数\nField Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 4, 17, 19));
|
||
ws.GetRow(rowIndex + 3).GetCell(17).SetCellValue("实际检测比例\nActual exam. Rate");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 4, 20, 20));
|
||
ws.GetRow(rowIndex + 3).GetCell(20).SetCellValue("检测报告编号\nExamination Report No.");
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 8;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 8 : ((num - 2) * 8) + 8;
|
||
dEnd = ((num - 1) * 8) + 8;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
|
||
int j = 0;
|
||
for (int i = 3; i < 14; i++)
|
||
{
|
||
if (i == 3 || i == 4)
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 30f;
|
||
continue;
|
||
}
|
||
if (i == 13)
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 30f;
|
||
}
|
||
else
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 17f;
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
var dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(0).SetCellValue("模拟数据");
|
||
}
|
||
j++;
|
||
}
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 3, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 5, 6));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 7, 8));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 11, 12));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 13, 14));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 15, 16));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 17, 19));
|
||
}
|
||
ws.GetRow(rowIndex + 13).GetCell(0).SetCellValue("小计\nTotal");
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 14, rowIndex + 16, style, 0, 20, true);
|
||
//设置行高
|
||
ws.GetRow(rowIndex + 14).HeightInPoints = 30f;
|
||
ws.GetRow(rowIndex + 15).HeightInPoints = 30f;
|
||
ws.GetRow(rowIndex + 16).HeightInPoints = 125f;
|
||
|
||
ws.GetRow(rowIndex + 14).GetCell(0).SetCellValue("备注\nRemark");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 14, rowIndex + 14, 1, 20));
|
||
|
||
ws.GetRow(rowIndex + 14).GetCell(1).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 14).GetCell(1).SetCellValue("焊口位置与检测焊口见管道单线图与无损检测报告。\nPlease refer to Pipeline Iso-drawing and NDE Report for joints position and examined joints.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 0, 3));
|
||
ws.GetRow(rowIndex + 15).GetCell(0).SetCellValue("建 设 / 监 理 单 位\nOwner/JianLi Company");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 4, 9));
|
||
ws.GetRow(rowIndex + 15).GetCell(4).SetCellValue("总 承 包 单 位\nGeneral Contractor");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 10, 16));
|
||
ws.GetRow(rowIndex + 15).GetCell(10).SetCellValue("检 测 单 位\nExamination Contractor");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 17, 20));
|
||
ws.GetRow(rowIndex + 15).GetCell(17).SetCellValue("施 工 单 位\nConstruction Company");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 0, 3));
|
||
ws.GetRow(rowIndex + 16).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 16).GetCell(0).SetCellValue("专业工程师\n Discipline Engineer: \n\n\n\n\n\n 日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 4, 9));
|
||
ws.GetRow(rowIndex + 16).GetCell(4).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 16).GetCell(4).SetCellValue("专业工程师\n Discipline Engineer: \n\n\n\n\n\n 日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 10, 16));
|
||
ws.GetRow(rowIndex + 16).GetCell(10).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 16).GetCell(10).SetCellValue("专业工程师\n Discipline Engineer: \n\n\n\n\n\n 日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 17, 20));
|
||
ws.GetRow(rowIndex + 16).GetCell(17).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 16).GetCell(17).SetCellValue("专业工程师\n Discipline Engineer: \n 质量检查员:\n Quality Inspector:\n 制表:\n\n Prepared:\n 日期Date: 年 月 日");
|
||
|
||
#endregion
|
||
|
||
rowIndex += 17;
|
||
}
|
||
|
||
ws.PrintSetup.Landscape = true;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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.HorizontallyCenter = true;
|
||
//ws.VerticallyCenter = 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);
|
||
|
||
}
|
||
|
||
//24-TP-10-渗透&MT检测比例确认表
|
||
private void template25_1(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
//模拟数据
|
||
string sql = @"select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 8 ? 1 : Math.Ceiling((float)(tbNum - 8) / 8) + 1;
|
||
|
||
int rowIndex = 0;
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
|
||
#region 头部
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Right, 9, true, false, "Arial Unicode MS");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex, style1, 0, 20, true);
|
||
|
||
//设置行宽度
|
||
ws.SetColumnWidth(0, 13 * 256);//A
|
||
ws.SetColumnWidth(1, 2 * 256);//B
|
||
ws.SetColumnWidth(2, 7 * 256);//C
|
||
ws.SetColumnWidth(3, 5 * 256);//D
|
||
ws.SetColumnWidth(4, 4 * 256);//E
|
||
ws.SetColumnWidth(5, 5 * 256);//F
|
||
ws.SetColumnWidth(6, 6 * 256);//G
|
||
ws.SetColumnWidth(7, 6 * 256);//H
|
||
ws.SetColumnWidth(8, 6 * 256);//I
|
||
ws.SetColumnWidth(9, 5 * 256);//J
|
||
ws.SetColumnWidth(10, 5 * 256);//K
|
||
ws.SetColumnWidth(11, 5 * 256);//L
|
||
ws.SetColumnWidth(12, 7 * 256);//M
|
||
ws.SetColumnWidth(13, 5 * 256);//N
|
||
ws.SetColumnWidth(14, 5 * 256);//O
|
||
ws.SetColumnWidth(15, 5 * 256);//P
|
||
ws.SetColumnWidth(16, 5 * 256);//Q
|
||
ws.SetColumnWidth(17, 6 * 256);//R
|
||
ws.SetColumnWidth(18, 6 * 256);//S
|
||
ws.SetColumnWidth(19, 6 * 256);//T
|
||
ws.SetColumnWidth(20, 13 * 256);//U
|
||
|
||
//设置行高度
|
||
ws.GetRow(rowIndex).HeightInPoints = 10f;
|
||
ws.GetRow(rowIndex).GetCell(20).CellStyle = style1;
|
||
ws.GetRow(rowIndex).GetCell(20).SetCellValue("Form No. TP-10");
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 2, style, 0, 20, true);
|
||
//设置行高度
|
||
ws.GetRow(rowIndex + 1).HeightInPoints = 90f;
|
||
ws.GetRow(rowIndex + 2).HeightInPoints = 30f;
|
||
|
||
//合并单元格和填充文本
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 0, 2));
|
||
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("");
|
||
|
||
var style3 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 13, true, true, "Arial Unicode MS");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 3, 17));
|
||
ws.GetRow(rowIndex + 1).GetCell(3).CellStyle = style3;
|
||
ws.GetRow(rowIndex + 1).GetCell(3).SetCellValue($"管道焊接接头PMI检测比例确认表(一)\nPipeline Welding Joints PMI Examination Rate Confirmation Form(I)\n共 {pageNum} 页 第 {num} 页");
|
||
|
||
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 9, true, false, "Arial Unicode MS");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 18, 20));
|
||
ws.GetRow(rowIndex + 1).GetCell(18).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 1).GetCell(18).SetCellValue($"\n工程名称:{info?.projectName}\n Project Name:{info?.enProjectName}\n 单元名称:{info?.workAreaName}\n Unit Name:{info?.enWorkAreaName}");
|
||
|
||
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("执行标准\nApplicable code");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 1, 5));
|
||
ws.GetRow(rowIndex + 2).GetCell(1).SetCellValue("");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 6, 7));
|
||
ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("检测方法\nExam. Method");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 15));
|
||
ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("PMI检测");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 16, 17));
|
||
ws.GetRow(rowIndex + 2).GetCell(16).SetCellValue("检测比例\nExam. Rate");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 18, 20));
|
||
ws.GetRow(rowIndex + 2).GetCell(18).SetCellValue("2%");
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 3, rowIndex + 13, style, 0, 20, true);
|
||
//设置高度和合并列填充文本
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 4, 0, 1));
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("管道编号\nPipeline No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 4, 2, 2));
|
||
ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue("材质\nMaterial");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 4, 3, 4));
|
||
ws.GetRow(rowIndex + 3).GetCell(3).SetCellValue("规 格/Size\n mm");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 8));
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("管道焊接接头\nWelding Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 9, 12));
|
||
ws.GetRow(rowIndex + 3).GetCell(9).SetCellValue("施焊焊工\nWelder");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 13, 16));
|
||
ws.GetRow(rowIndex + 3).GetCell(13).SetCellValue("检测焊接接头\nExanined Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 6));
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("总数\nTotal");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 7, 8));
|
||
ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("固定口数\nField Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 9, 10));
|
||
ws.GetRow(rowIndex + 4).GetCell(9).SetCellValue("焊工代号\nWelder No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 11, 12));
|
||
ws.GetRow(rowIndex + 4).GetCell(11).SetCellValue("施焊数量\nWelded Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 13, 14));
|
||
ws.GetRow(rowIndex + 4).GetCell(13).SetCellValue("总数\nTotal Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 15, 16));
|
||
ws.GetRow(rowIndex + 4).GetCell(15).SetCellValue("固定口数\nField Joints");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 4, 17, 19));
|
||
ws.GetRow(rowIndex + 3).GetCell(17).SetCellValue("实际检测比例\nActual exam. Rate");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 4, 20, 20));
|
||
ws.GetRow(rowIndex + 3).GetCell(20).SetCellValue("检测报告编号\nExamination Report No.");
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 8;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 8 : ((num - 2) * 8) + 8;
|
||
dEnd = ((num - 1) * 8) + 8;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int j = 0;
|
||
for (int i = 3; i < 14; i++)
|
||
{
|
||
if (i == 3 || i == 4)
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 30f;
|
||
continue;
|
||
}
|
||
|
||
if (i == 13)
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 30f;
|
||
}
|
||
else
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 17f;
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
var dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(0).SetCellValue("模拟数据");
|
||
}
|
||
j++;
|
||
}
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 3, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 5, 6));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 7, 8));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 11, 12));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 13, 14));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 15, 16));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 17, 19));
|
||
}
|
||
|
||
|
||
|
||
ws.GetRow(rowIndex + 13).GetCell(0).SetCellValue("小计\nTotal");
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 14, rowIndex + 16, style, 0, 20, true);
|
||
//设置行高
|
||
ws.GetRow(rowIndex + 14).HeightInPoints = 30f;
|
||
ws.GetRow(rowIndex + 15).HeightInPoints = 30f;
|
||
ws.GetRow(rowIndex + 16).HeightInPoints = 125f;
|
||
|
||
ws.GetRow(rowIndex + 14).GetCell(0).SetCellValue("备注\nRemark");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 14, rowIndex + 14, 1, 20));
|
||
|
||
ws.GetRow(rowIndex + 14).GetCell(1).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 14).GetCell(1).SetCellValue("焊口位置与检测焊口见管道单线图与无损检测报告。\nPlease refer to Pipeline Iso-drawing and NDE Report for joints position and examined joints.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 0, 3));
|
||
ws.GetRow(rowIndex + 15).GetCell(0).SetCellValue("建 设 / 监 理 单 位\nOwner/JianLi Company");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 4, 9));
|
||
ws.GetRow(rowIndex + 15).GetCell(4).SetCellValue("总 承 包 单 位\nGeneral Contractor");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 10, 16));
|
||
ws.GetRow(rowIndex + 15).GetCell(10).SetCellValue("检 测 单 位\nExamination Contractor");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 17, 20));
|
||
ws.GetRow(rowIndex + 15).GetCell(17).SetCellValue("施 工 单 位\nConstruction Company");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 0, 3));
|
||
ws.GetRow(rowIndex + 16).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 16).GetCell(0).SetCellValue("专业工程师\n Discipline Engineer: \n\n\n\n\n\n 日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 4, 9));
|
||
ws.GetRow(rowIndex + 16).GetCell(4).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 16).GetCell(4).SetCellValue("专业工程师\n Discipline Engineer: \n\n\n\n\n\n 日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 10, 16));
|
||
ws.GetRow(rowIndex + 16).GetCell(10).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 16).GetCell(10).SetCellValue("专业工程师\n Discipline Engineer: \n\n\n\n\n\n 日期Date: 年 月 日");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 17, 20));
|
||
ws.GetRow(rowIndex + 16).GetCell(17).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 16).GetCell(17).SetCellValue("专业工程师\n Discipline Engineer: \n 质量检查员:\n Quality Inspector:\n 制表:\n\n Prepared:\n 日期Date: 年 月 日");
|
||
|
||
#endregion
|
||
|
||
rowIndex += 17;
|
||
}
|
||
|
||
ws.PrintSetup.Landscape = true;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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.HorizontallyCenter = true;
|
||
//ws.VerticallyCenter = 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);
|
||
|
||
}
|
||
|
||
//25-管道无损检测结果汇总表SHT 3503-J412-2017
|
||
private void template25(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
int rowIndex = 0;
|
||
|
||
string sql = @"SELECT ROW_NUMBER() OVER(ORDER BY c.PipelineCode,c.WeldJointCode) AS Number,
|
||
c.PipelineCode,c.WeldJointCode, c.WelderCode,'/' AS PointBatchCode, '/' AS Remark,
|
||
(CASE WHEN c.DetectionTypeCode='RT' THEN c.NDEReportNo ELSE '' END) AS RTNDEReportNo,
|
||
(CASE WHEN c.DetectionTypeCode='RT' THEN c.CheckResult ELSE '' END) AS RTCheckResult,
|
||
(CASE WHEN c.DetectionTypeCode<>'RT' THEN c.NDEReportNo ELSE '' END) AS PTNDEReportNo,
|
||
(CASE WHEN c.DetectionTypeCode<>'RT' THEN c.CheckResult ELSE '' END) AS PTCheckResult
|
||
FROM dbo.View_CheckResultSummary c
|
||
WHERE c.WeldJointId IN
|
||
(SELECT
|
||
c.WeldJointId
|
||
FROM dbo.PTP_TestPackage AS a
|
||
INNER JOIN dbo.PTP_PipelineList AS b
|
||
ON a.PTP_ID=b.PTP_ID
|
||
LEFT JOIN dbo.Pipeline_WeldJoint AS C
|
||
ON b.PipelineId=c.PipelineId
|
||
WHERE b.isAll=1 AND a.PTP_ID=@PTPID and a.ProjectId=@ProjectId -- 传试压包ID参数
|
||
UNION ALL
|
||
SELECT
|
||
c.WeldJointId
|
||
FROM dbo.PTP_TestPackage AS a
|
||
INNER JOIN dbo.PTP_PipelineList AS b
|
||
ON a.PTP_ID=b.PTP_ID
|
||
LEFT JOIN dbo.Pipeline_WeldJoint AS C
|
||
ON b.PipelineId=c.PipelineId
|
||
WHERE b.isAll=0 AND a.PTP_ID=@PTPID and a.ProjectId=@ProjectId -- 传试压包ID参数
|
||
AND PATINDEX('%'+c.WeldJointCode+'%',b.WeldJonintCode)>0)
|
||
";
|
||
SqlParameter[] parms =
|
||
{
|
||
new SqlParameter("@PTPID",this.tvControlItem.SelectedNodeID),
|
||
new SqlParameter("@ProjectId",this.CurrUser.LoginProjectId)
|
||
};
|
||
DataTable tb = SQLHelper.GetDataTableRunText(sql, parms);
|
||
|
||
var tbNum = tb.Rows.Count;
|
||
var pageNum =
|
||
tbNum < 5 ? 1
|
||
: Math.Ceiling((float)(tbNum - 5) / 5) + 1;
|
||
|
||
for (int i = 1; i <= pageNum; i++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 3, style, 1, 18, true);
|
||
ws.SetColumnWidth(0, 1 * 256);//A
|
||
ws.SetColumnWidth(1, 10 * 256);//B
|
||
ws.SetColumnWidth(2, 6 * 256);//C
|
||
ws.SetColumnWidth(3, 6 * 256);//D
|
||
ws.SetColumnWidth(4, 6 * 256);//E
|
||
ws.SetColumnWidth(5, 6 * 256);//F
|
||
ws.SetColumnWidth(6, 12 * 256);//G
|
||
ws.SetColumnWidth(7, 7 * 256);//H
|
||
ws.SetColumnWidth(8, 7 * 256);//I
|
||
ws.SetColumnWidth(9, 7 * 256);//J
|
||
ws.SetColumnWidth(10, 7 * 256);//K
|
||
ws.SetColumnWidth(11, 8 * 256);//L
|
||
ws.SetColumnWidth(12, 7 * 256);//M
|
||
ws.SetColumnWidth(13, 7 * 256);//N
|
||
ws.SetColumnWidth(14, 6 * 256);//O
|
||
ws.SetColumnWidth(15, 8 * 256);//P
|
||
ws.SetColumnWidth(16, 4 * 256);//Q
|
||
ws.SetColumnWidth(17, 5 * 256);//R
|
||
ws.SetColumnWidth(18, 8 * 256);//S
|
||
|
||
|
||
ws.GetRow(rowIndex + 1).HeightInPoints = 85f;
|
||
ws.GetRow(rowIndex + 2).HeightInPoints = 35f;
|
||
ws.GetRow(rowIndex + 3).HeightInPoints = 35f;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 1, 5));
|
||
ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("SH/T 3503-J412-1");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 6, 13));
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
style1.WrapText = true;
|
||
ws.GetRow(rowIndex + 1).GetCell(6).CellStyle = style1;
|
||
ws.GetRow(rowIndex + 1).GetCell(6).SetCellValue($"管道无损检测结果汇总表\nSummary of Piping NDT Results\n第 {i} 页 共 {pageNum} 页 Page of ");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 14, 18));
|
||
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, false, false, "Arial Unicode MS");
|
||
style2.WrapText = true;
|
||
ws.GetRow(rowIndex + 1).GetCell(14).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 1).GetCell(14).SetCellValue($"工程名称:{info?.projectName}\nProject Name:{info?.enProjectName}\n单位工程名称:{info?.workAreaName}\nUnit Name:{info?.enWorkAreaName}");
|
||
|
||
ws.GetRow(rowIndex + 2).GetCell(1).SetCellValue("Supervision Contractor");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 2, 5));
|
||
|
||
ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("Construction Contractor");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 7, 10));
|
||
|
||
ws.GetRow(rowIndex + 2).GetCell(11).SetCellValue("Test Criteria");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 12, 14));
|
||
|
||
ws.GetRow(rowIndex + 2).GetCell(15).SetCellValue("Piping Class");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 16, 18));
|
||
|
||
ws.GetRow(rowIndex + 3).GetCell(1).SetCellValue("Area No.");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 4));
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 6));
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("Test Type No.");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 7, 10));
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 11, 12));
|
||
ws.GetRow(rowIndex + 3).GetCell(11).SetCellValue("Piping No.");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 13, 18));
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 4, rowIndex + 16, style, 1, 18, true);
|
||
|
||
//第一部分表格部分
|
||
ws.GetRow(rowIndex + 4).HeightInPoints = 36f;
|
||
ws.GetRow(rowIndex + 5).HeightInPoints = 36f;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 1, 1));
|
||
ws.GetRow(rowIndex + 4).GetCell(1).SetCellValue("Test Method");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 2, 9));
|
||
ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue("Test Quantity Statistics\n(RT Unit:Weld/Film;UT/MT/PT/ Unit:Weld/Meter)");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 10, 18));
|
||
ws.GetRow(rowIndex + 4).GetCell(10).SetCellValue("Non-conformity Statistics\n(RT Unit:Weld/Film;UT/MT/PT/ Unit:Weld/Meter)");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 2, 3));
|
||
ws.GetRow(rowIndex + 5).GetCell(2).SetCellValue("Butt-welded Joint");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 4, 5));
|
||
ws.GetRow(rowIndex + 5).GetCell(4).SetCellValue("Fillet-welded Joint");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 6, 7));
|
||
ws.GetRow(rowIndex + 5).GetCell(6).SetCellValue("Branch Connection");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 8, 9));
|
||
ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue("Groove & Others");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 10, 11));
|
||
ws.GetRow(rowIndex + 5).GetCell(10).SetCellValue("Butt-welded Joint");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 12, 13));
|
||
ws.GetRow(rowIndex + 5).GetCell(12).SetCellValue("Fillet-welded Joint");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 14, 15));
|
||
ws.GetRow(rowIndex + 5).GetCell(14).SetCellValue("Branch Connection");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 16, 18));
|
||
ws.GetRow(rowIndex + 5).GetCell(16).SetCellValue("Groove & Others");
|
||
|
||
ws.GetRow(rowIndex + 6).GetCell(1).SetCellValue("RT");
|
||
ws.GetRow(rowIndex + 7).GetCell(1).SetCellValue("UT");
|
||
ws.GetRow(rowIndex + 8).GetCell(1).SetCellValue("MT");
|
||
ws.GetRow(rowIndex + 9).GetCell(1).SetCellValue("PT");
|
||
//第二部分表格部分
|
||
ws.GetRow(rowIndex + 11).HeightInPoints = 60f;
|
||
|
||
var qq = from x in Funs.DB.View_CheckResultSummary where x.PTP_ID == this.PTP_ID select x;
|
||
|
||
// 合格
|
||
var rt = qq.Where(x => x.DetectionTypeCode == "RT" && x.CheckResult == "合格");
|
||
string bRt = "/";
|
||
if (rt.Count() > 0)
|
||
{
|
||
bRt = rt.Count().ToString() + "/" + rt.Sum(x => x.TotalFilm).ToString();
|
||
}
|
||
|
||
var jpt = qq.Where(x => x.DetectionTypeCode == "PT" && x.CheckResult == "合格" && x.WeldType == "2");
|
||
string ptj = "/";
|
||
if (jpt.Count() > 0)
|
||
{
|
||
ptj = jpt.Count().ToString();
|
||
}
|
||
|
||
var zpt = qq.Where(x => x.DetectionTypeCode == "PT" && x.CheckResult == "合格" && x.WeldType == "3");
|
||
string ptz = "/";
|
||
if (zpt.Count() > 0)
|
||
{
|
||
ptz = zpt.Count().ToString();
|
||
}
|
||
|
||
// 不合格
|
||
var nrt = qq.Where(x => x.DetectionTypeCode == "RT" && x.CheckResult == "不合格");
|
||
|
||
string nbRt = "/";
|
||
if (nrt.Count() > 0)
|
||
{
|
||
nbRt = nrt.Count().ToString() + "/" + nrt.Sum(x => x.TotalFilm).ToString();
|
||
}
|
||
|
||
var njpt = qq.Where(x => x.DetectionTypeCode == "PT" && x.CheckResult == "不合格" && x.WeldType == "2");
|
||
string nptj = "/";
|
||
if (njpt.Count() > 0)
|
||
{
|
||
nptj = njpt.Count().ToString();
|
||
}
|
||
|
||
var nzpt = qq.Where(x => x.DetectionTypeCode == "PT" && x.CheckResult == "不合格" && x.WeldType == "3");
|
||
string nptz = "/";
|
||
if (nzpt.Count() > 0)
|
||
{
|
||
nptz = nzpt.Count().ToString();
|
||
}
|
||
|
||
|
||
for (int k = 6; k < 11; k++)
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + k, rowIndex + k, 2, 3));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + k, rowIndex + k, 4, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + k, rowIndex + k, 6, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + k, rowIndex + k, 8, 9));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + k, rowIndex + k, 10, 11));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + k, rowIndex + k, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + k, rowIndex + k, 14, 15));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + k, rowIndex + k, 16, 18));
|
||
ws.GetRow(rowIndex + k).HeightInPoints = 18f;
|
||
if (k == 10)
|
||
break;
|
||
//RT值
|
||
if (k == 6)
|
||
{
|
||
ws.GetRow(rowIndex + k).GetCell(2).SetCellValue(bRt);
|
||
ws.GetRow(rowIndex + k).GetCell(10).SetCellValue(nbRt);
|
||
}
|
||
else
|
||
{
|
||
ws.GetRow(rowIndex + k).GetCell(2).SetCellValue("/");
|
||
}
|
||
if (k == 9)
|
||
{
|
||
ws.GetRow(rowIndex + k).GetCell(4).SetCellValue(ptj);
|
||
ws.GetRow(rowIndex + k).GetCell(6).SetCellValue(ptz);
|
||
ws.GetRow(rowIndex + k).GetCell(12).SetCellValue(nptj);
|
||
ws.GetRow(rowIndex + k).GetCell(14).SetCellValue(nptz);
|
||
}
|
||
if (k == 6 || k == 7)
|
||
{
|
||
ws.GetRow(rowIndex + k).GetCell(4).SetCellValue("-");
|
||
ws.GetRow(rowIndex + k).GetCell(12).SetCellValue("-");
|
||
}
|
||
|
||
ws.GetRow(rowIndex + k).GetCell(6).SetCellValue("/");
|
||
ws.GetRow(rowIndex + k).GetCell(8).SetCellValue("/");
|
||
ws.GetRow(rowIndex + k).GetCell(16).SetCellValue("/");
|
||
}
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 1, 2));
|
||
ws.GetRow(rowIndex + 11).GetCell(1).SetCellValue("Line No.");
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(3).SetCellValue("weld No.");
|
||
ws.GetRow(rowIndex + 11).GetCell(4).SetCellValue("Welder's Stamp No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 5, 6));
|
||
ws.GetRow(rowIndex + 11).GetCell(5).SetCellValue("Test Lot No.");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 7, 8));
|
||
ws.GetRow(rowIndex + 11).GetCell(7).SetCellValue("RT/UT Result");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 9, 10));
|
||
ws.GetRow(rowIndex + 11).GetCell(9).SetCellValue("Report No.");
|
||
ws.GetRow(rowIndex + 11).GetCell(11).SetCellValue("MT/PT Result");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 12, 13));
|
||
ws.GetRow(rowIndex + 11).GetCell(12).SetCellValue("Report No.");
|
||
ws.GetRow(rowIndex + 11).GetCell(14).SetCellValue("Result");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 15, 16));
|
||
ws.GetRow(rowIndex + 11).GetCell(15).SetCellValue("Report No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 11, rowIndex + 11, 17, 18));
|
||
ws.GetRow(rowIndex + 11).GetCell(17).SetCellValue("Remarks");
|
||
var dataTit = rowIndex + 12;
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (i == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 5;
|
||
}
|
||
else
|
||
{
|
||
dStart = i == 2 ? 5 : ((i - 2) * 5) + 5;
|
||
dEnd = ((i - 1) * 5) + 5;
|
||
}
|
||
//获取当前页数据
|
||
var pageTb = GetPageToTable(tb, dStart, dEnd);
|
||
int j = 0;
|
||
for (int hb = rowIndex + 12; hb < rowIndex + 17; hb++)
|
||
{
|
||
ws.GetRow(hb).Height = 18 * 20;
|
||
ws.AddMergedRegion(new CellRangeAddress(hb, hb, 1, 2));
|
||
ws.AddMergedRegion(new CellRangeAddress(hb, hb, 5, 6));
|
||
ws.AddMergedRegion(new CellRangeAddress(hb, hb, 7, 8));
|
||
ws.AddMergedRegion(new CellRangeAddress(hb, hb, 9, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(hb, hb, 12, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(hb, hb, 15, 16));
|
||
ws.AddMergedRegion(new CellRangeAddress(hb, hb, 17, 18));
|
||
}
|
||
foreach (DataRow dr in pageTb.Rows)
|
||
{
|
||
var dataIndex = dataTit + j;
|
||
ws.GetRow(dataIndex).GetCell(1).SetCellValue(dr["PipelineCode"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(3).SetCellValue(dr["WeldJointCode"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(4).SetCellValue(dr["WelderCode"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(5).SetCellValue(dr["PointBatchCode"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(7).SetCellValue(dr["RTCheckResult"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(9).SetCellValue(dr["RTNDEReportNo"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(11).SetCellValue(dr["PTCheckResult"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(12).SetCellValue(dr["PTNDEReportNo"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(14).SetCellValue("");
|
||
ws.GetRow(dataIndex).GetCell(15).SetCellValue("");
|
||
ws.GetRow(dataIndex).GetCell(17).SetCellValue(dr["Remark"].ToString());
|
||
j++;
|
||
}
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 11, true, false, "Arial Unicode MS");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 17, rowIndex + 17, style, 1, 18, true);
|
||
ws.GetRow(rowIndex + 17).HeightInPoints = 60f;
|
||
|
||
var setStyle2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 11, false, false, "Arial Unicode MS");
|
||
setStyle2.WrapText = true;
|
||
ws.GetRow(rowIndex + 17).GetCell(1).CellStyle = ws.GetRow(rowIndex + 17).GetCell(7).CellStyle = ws.GetRow(rowIndex + 17).GetCell(13).CellStyle = setStyle2;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 1, 6));
|
||
ws.GetRow(rowIndex + 17).GetCell(1).SetCellValue(" Responsible Inspector:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 7, 12));
|
||
ws.GetRow(rowIndex + 17).GetCell(7).SetCellValue(" Technical Superintendent:\n\n Quality Superintendent:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 13, 18));
|
||
ws.GetRow(rowIndex + 17).GetCell(13).SetCellValue(" Inspection Agency: (Seal)\n\n Date:");
|
||
|
||
|
||
#endregion
|
||
|
||
rowIndex += 18;
|
||
}
|
||
|
||
ws.PrintSetup.Landscape = true;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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);
|
||
|
||
}
|
||
|
||
//26-管道无损检测数量统计表SHT 3503-J413-2017
|
||
private void template26(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
|
||
//模拟数据
|
||
string sql = @"select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 9 ? 1 : Math.Ceiling((float)(tbNum - 9) / 18) + 1;
|
||
|
||
int rowIndex = 0;
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 6, style, 1, 23, true);
|
||
ws.SetColumnWidth(0, 2 * 256);
|
||
ws.SetColumnWidth(1, 9 * 256);
|
||
ws.SetColumnWidth(2, 3 * 256);
|
||
ws.SetColumnWidth(3, 11 * 256);
|
||
ws.SetColumnWidth(4, 3 * 256);
|
||
ws.SetColumnWidth(5, 9 * 256);
|
||
ws.SetColumnWidth(6, 2 * 256);
|
||
ws.SetColumnWidth(7, 5 * 256);
|
||
ws.SetColumnWidth(8, 5 * 256);
|
||
ws.SetColumnWidth(9, 5 * 256);
|
||
ws.SetColumnWidth(10, 5 * 256);
|
||
ws.SetColumnWidth(11, 5 * 256);
|
||
ws.SetColumnWidth(12, 5 * 256);
|
||
ws.SetColumnWidth(13, 5 * 256);
|
||
ws.SetColumnWidth(14, 5 * 256);
|
||
ws.SetColumnWidth(15, 5 * 256);
|
||
ws.SetColumnWidth(16, 5 * 256);
|
||
ws.SetColumnWidth(17, 5 * 256);
|
||
ws.SetColumnWidth(18, 5 * 256);
|
||
ws.SetColumnWidth(19, 5 * 256);
|
||
ws.SetColumnWidth(20, 5 * 256);
|
||
ws.SetColumnWidth(21, 5 * 256);
|
||
ws.SetColumnWidth(22, 5 * 256);
|
||
ws.SetColumnWidth(23, 9 * 256);
|
||
|
||
for (int i = 1; i < 6; i++)
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 16f;
|
||
}
|
||
ws.GetRow(rowIndex + 6).HeightInPoints = 30f;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 5, 1, 3));
|
||
ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("SH/T 3503-J413-1");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 5, 4, 16));
|
||
string title = num == 1 ? $"管道无损检测数量统计表 ;\n Piping NDT Quantity Statistical From ;\n 第 {num} 页 共 {pageNum} 页 Page of " : $"管道无损检测数量统计表(续) ;\n Piping NDT Quantity Statistical From ;\n 第 {num} 页 共 {pageNum} 页 Page of ";
|
||
ws.GetRow(rowIndex + 1).GetCell(4).SetCellValue(title);
|
||
var setStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
ws.GetRow(rowIndex + 1).GetCell(4).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 5, 17, 23));
|
||
ws.GetRow(rowIndex + 1).GetCell(17).SetCellValue($"工程名称:{info?.projectName}\n Project Name:{info?.enProjectName}\n 单位工程名称:{info?.workAreaName}\n Unit Name:{info?.enWorkAreaName}");
|
||
var setStyle1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 11, false, false, "Arial Unicode MS");
|
||
setStyle1.WrapText = true;
|
||
ws.GetRow(rowIndex + 1).GetCell(17).CellStyle = setStyle1;
|
||
|
||
ws.GetRow(rowIndex + 6).GetCell(1).SetCellValue("Area No.");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 2, 3));
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 4, 5));
|
||
ws.GetRow(rowIndex + 6).GetCell(4).SetCellValue("Test Type No.");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 6, 11));
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 12, 14));
|
||
ws.GetRow(rowIndex + 6).GetCell(12).SetCellValue("Acceptance Criteria");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 15, 18));
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 19, 20));
|
||
ws.GetRow(rowIndex + 6).GetCell(19).SetCellValue("Test Criteria");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 21, 23));
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
var rend = num == 1 ? 18 : 27;
|
||
|
||
|
||
style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 11, true, false, "Arial Unicode MS");
|
||
//ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 7, rowIndex + 18, style, 1, 23, true);
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 7, rowIndex + rend, style, 1, 23, true);
|
||
|
||
ws.GetRow(rowIndex + 7).HeightInPoints = 20f;
|
||
ws.GetRow(rowIndex + 8).HeightInPoints = 30f;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 9, 1, 2));
|
||
ws.GetRow(rowIndex + 7).GetCell(1).SetCellValue("Piping No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 9, 3, 4));
|
||
ws.GetRow(rowIndex + 7).GetCell(3).SetCellValue("Included Line No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 9, 5, 6));
|
||
ws.GetRow(rowIndex + 7).GetCell(5).SetCellValue("Test Percentage");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 7, 22));
|
||
ws.GetRow(rowIndex + 7).GetCell(7).SetCellValue("Qualified Quantity");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 8, 23, 23));
|
||
ws.GetRow(rowIndex + 7).GetCell(23).SetCellValue("Remarks");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 8, rowIndex + 8, 7, 11));
|
||
ws.GetRow(rowIndex + 8).GetCell(7).SetCellValue("Butt-welded Joint");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 8, rowIndex + 8, 12, 14));
|
||
ws.GetRow(rowIndex + 8).GetCell(12).SetCellValue("Fillet-welded Joint");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 8, rowIndex + 8, 15, 19));
|
||
ws.GetRow(rowIndex + 8).GetCell(15).SetCellValue("Branch Connection");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 8, rowIndex + 8, 20, 22));
|
||
ws.GetRow(rowIndex + 8).GetCell(20).SetCellValue("Groove & Others");
|
||
|
||
ws.GetRow(rowIndex + 9).GetCell(7).SetCellValue("Total");
|
||
ws.GetRow(rowIndex + 9).GetCell(8).SetCellValue("RT");
|
||
ws.GetRow(rowIndex + 9).GetCell(9).SetCellValue("UT");
|
||
ws.GetRow(rowIndex + 9).GetCell(10).SetCellValue("MT");
|
||
ws.GetRow(rowIndex + 9).GetCell(11).SetCellValue("PT");
|
||
ws.GetRow(rowIndex + 9).GetCell(12).SetCellValue("Total");
|
||
ws.GetRow(rowIndex + 9).GetCell(13).SetCellValue("MT");
|
||
ws.GetRow(rowIndex + 9).GetCell(14).SetCellValue("PT");
|
||
ws.GetRow(rowIndex + 9).GetCell(15).SetCellValue("Total");
|
||
ws.GetRow(rowIndex + 9).GetCell(16).SetCellValue("RT");
|
||
ws.GetRow(rowIndex + 9).GetCell(17).SetCellValue("UT");
|
||
ws.GetRow(rowIndex + 9).GetCell(18).SetCellValue("MT");
|
||
ws.GetRow(rowIndex + 9).GetCell(19).SetCellValue("PT");
|
||
ws.GetRow(rowIndex + 9).GetCell(20).SetCellValue("Total");
|
||
ws.GetRow(rowIndex + 9).GetCell(21).SetCellValue("MT");
|
||
ws.GetRow(rowIndex + 9).GetCell(22).SetCellValue("PT");
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 9;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 9 : ((num - 2) * 18) + 9;
|
||
dEnd = ((num - 1) * 18) + 9;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int j = 0;
|
||
|
||
for (int i = 10; i <= rend; i++)
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 1, 2));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 3, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 5, 6));
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 18f;
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
var dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(1).SetCellValue("模拟数据");
|
||
}
|
||
j++;
|
||
}
|
||
|
||
#endregion
|
||
|
||
|
||
#region 尾部
|
||
|
||
if (num == 1)
|
||
{
|
||
style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 11, true, false, "Arial Unicode MS");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 19, rowIndex + 20, style, 1, 23, true);
|
||
ws.GetRow(rowIndex + 19).HeightInPoints = 25f;
|
||
ws.GetRow(rowIndex + 20).Height = 20 * 20 * 7;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 19, rowIndex + 19, 1, 7));
|
||
ws.GetRow(rowIndex + 19).GetCell(1).SetCellValue("Owner/Supervision Contractor");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 19, rowIndex + 19, 8, 15));
|
||
ws.GetRow(rowIndex + 19).GetCell(8).SetCellValue("General Contractor");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 19, rowIndex + 19, 16, 23));
|
||
ws.GetRow(rowIndex + 19).GetCell(16).SetCellValue("Construction Contractor");
|
||
|
||
|
||
var setStyle2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 11, false, false, "Arial Unicode MS");
|
||
setStyle2.WrapText = true;
|
||
ws.GetRow(rowIndex + 20).GetCell(1).CellStyle = ws.GetRow(rowIndex + 20).GetCell(8).CellStyle = ws.GetRow(rowIndex + 20).GetCell(16).CellStyle = setStyle2;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 20, rowIndex + 20, 1, 7));
|
||
ws.GetRow(rowIndex + 20).GetCell(1).SetCellValue(" Discipline Engineer:\n\n\n\n\n\nDate:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 20, rowIndex + 20, 8, 15));
|
||
ws.GetRow(rowIndex + 20).GetCell(8).SetCellValue(" Discipline Engineer:\n\n\n\n\n\n Date:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 20, rowIndex + 20, 16, 23));
|
||
ws.GetRow(rowIndex + 20).GetCell(16).SetCellValue(" Quality Inspector: \n \n Discipline Engineer: \n\n From Prepared by:\n\n Date:");
|
||
}
|
||
|
||
#endregion
|
||
|
||
|
||
rowIndex += num == 1 ? 21 : 28;
|
||
}
|
||
|
||
ws.PrintSetup.Landscape = true;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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);
|
||
|
||
}
|
||
|
||
//27-TP-11-尾项清单UG-FW-001
|
||
private void template27(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
//插入图片部分
|
||
var img1 = Server.MapPath("~/res/images/bsf/1.png");
|
||
var img2 = Server.MapPath("~/res/images/bsf/2.png");
|
||
var img3 = Server.MapPath("~/res/images/bsf/3.png");
|
||
var img4 = Server.MapPath("~/res/images/bsf/4.png");
|
||
|
||
//模拟数据
|
||
string sql = @"select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 12 ? 1 : Math.Ceiling((float)(tbNum - 12) / 12) + 1;
|
||
int rowIndex = 0;
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, false, "Arial Unicode MS");
|
||
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 12, true, false, "Arial Unicode MS");
|
||
|
||
var style3 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 16, true, true, "Arial Unicode MS");
|
||
|
||
var style4 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 24, true, true, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 7, style, 0, 24, true);
|
||
|
||
//设置行高和列宽
|
||
ws.SetColumnWidth(0, 5 * 256);//A
|
||
ws.SetColumnWidth(1, 5 * 256);//B
|
||
ws.SetColumnWidth(2, 6 * 256);//C
|
||
ws.SetColumnWidth(3, 2 * 256);//D
|
||
ws.SetColumnWidth(4, 5 * 256);//E
|
||
ws.SetColumnWidth(5, 6 * 256);//F
|
||
ws.SetColumnWidth(6, 6 * 256);//G
|
||
ws.SetColumnWidth(7, 4 * 256);//H
|
||
ws.SetColumnWidth(8, 5 * 256);//I
|
||
ws.SetColumnWidth(9, 5 * 256);//J
|
||
ws.SetColumnWidth(10, 5 * 256);//K
|
||
ws.SetColumnWidth(11, 5 * 256);//L
|
||
ws.SetColumnWidth(12, 4 * 256);//M
|
||
ws.SetColumnWidth(13, 5 * 256);//N
|
||
ws.SetColumnWidth(14, 5 * 256);//O
|
||
ws.SetColumnWidth(15, 5 * 256);//P
|
||
ws.SetColumnWidth(16, 6 * 256);//Q
|
||
ws.SetColumnWidth(17, 6 * 256);//R
|
||
ws.SetColumnWidth(18, 6 * 256);//S
|
||
ws.SetColumnWidth(19, 6 * 256);//T
|
||
ws.SetColumnWidth(20, 6 * 256);//U
|
||
ws.SetColumnWidth(21, 6 * 256);//V
|
||
ws.SetColumnWidth(22, 7 * 256);//W
|
||
ws.SetColumnWidth(23, 4 * 256);//X
|
||
ws.SetColumnWidth(24, 3 * 256);//Y
|
||
|
||
ws.GetRow(rowIndex).HeightInPoints = 10f;
|
||
ws.GetRow(rowIndex + 1).HeightInPoints = 50f;
|
||
ws.GetRow(rowIndex + 2).HeightInPoints = 8f;
|
||
ws.GetRow(rowIndex + 3).HeightInPoints = 35f;
|
||
ws.GetRow(rowIndex + 4).HeightInPoints = 18f;
|
||
ws.GetRow(rowIndex + 5).HeightInPoints = 18f;
|
||
ws.GetRow(rowIndex + 6).HeightInPoints = 18f;
|
||
ws.GetRow(rowIndex + 7).HeightInPoints = 35f;
|
||
|
||
//合并单元格和填充文本
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 22, 24));
|
||
ws.GetRow(rowIndex).GetCell(22).SetCellValue("Form No. TP-11");
|
||
ws.GetRow(rowIndex).GetCell(22).CellStyle = style1;
|
||
|
||
//画线
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex, rowIndex, 0, 24), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 6, 18));
|
||
ws.GetRow(rowIndex + 1).GetCell(6).SetCellValue("巴斯夫(广东)一体化项目\nBASF (Guangdong) Integrated Project");
|
||
ws.GetRow(rowIndex + 1).GetCell(6).CellStyle = style3;
|
||
|
||
//画线
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 0, 24), ws);
|
||
//画线
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 24), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 6, 3, 15));
|
||
ws.GetRow(rowIndex + 3).GetCell(3).SetCellValue("PUNCH LIST\n尾项清单");
|
||
ws.GetRow(rowIndex + 3).GetCell(3).CellStyle = style4;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 16, 18));
|
||
ws.GetRow(rowIndex + 3).GetCell(16).CellStyle = style1;
|
||
ws.GetRow(rowIndex + 3).GetCell(16).SetCellValue("项目/PROJECT");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 19, 24));
|
||
ws.GetRow(rowIndex + 3).GetCell(19).CellStyle = style1;
|
||
ws.GetRow(rowIndex + 3).GetCell(19).SetCellValue("巴斯夫(广东)一体化项目\nBASF (Guangdong) Integrated Project");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 16, 18));
|
||
ws.GetRow(rowIndex + 4).GetCell(16).CellStyle = style1;
|
||
ws.GetRow(rowIndex + 4).GetCell(16).SetCellValue("区域/AREA");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 19, 24));
|
||
ws.GetRow(rowIndex + 4).GetCell(19).CellStyle = style1;
|
||
ws.GetRow(rowIndex + 4).GetCell(19).SetCellValue(info?.workAreaCode);
|
||
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 6, 16, 18));
|
||
ws.GetRow(rowIndex + 5).GetCell(16).CellStyle = style1;
|
||
ws.GetRow(rowIndex + 5).GetCell(16).SetCellValue("试压包号/TEST PACKAGE No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 6, 19, 24));
|
||
ws.GetRow(rowIndex + 5).GetCell(19).CellStyle = style1;
|
||
ws.GetRow(rowIndex + 5).GetCell(19).SetCellValue(info?.testpackageNo);
|
||
//画线
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 6, rowIndex + 6, 0, 24), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 4, rowIndex + 4, 16, 24), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 3, rowIndex + 3, 16, 24), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 3, rowIndex + 6, 18, 18), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 3, rowIndex + 6, 15, 15), ws);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 0, 2));
|
||
ws.GetRow(rowIndex + 7).GetCell(0).CellStyle = style1;
|
||
ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("系统号\nSYSTEM No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 3, 15));
|
||
ws.GetRow(rowIndex + 7).GetCell(3).CellStyle = style1;
|
||
ws.GetRow(rowIndex + 7).GetCell(3).SetCellValue("UG");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 16, 18));
|
||
ws.GetRow(rowIndex + 7).GetCell(16).CellStyle = style1;
|
||
ws.GetRow(rowIndex + 7).GetCell(16).SetCellValue("子系统号\nSUB-SYSTEM No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 19, 24));
|
||
ws.GetRow(rowIndex + 7).GetCell(19).CellStyle = style1;
|
||
ws.GetRow(rowIndex + 7).GetCell(19).SetCellValue("FW");
|
||
//画线
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 7, rowIndex + 7, 2, 2), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 7, rowIndex + 7, 15, 15), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 7, rowIndex + 7, 18, 18), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 7, rowIndex + 7, 0, 24), ws);
|
||
|
||
|
||
//插入图片
|
||
InsertImage(hssfworkbook, ws, rowIndex + 1, 1, rowIndex + 1, 2, img1, 1.8, 1);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 1, 4, rowIndex + 1, 5, img2, 1.8, 1, 0, 1);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 1, 19, rowIndex + 1, 20, img3, 1.8, 0.7, 0, 10);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 1, 21, rowIndex + 1, 23, img4, 1.2, 0.9, 0, 5);
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
var style5 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 8, rowIndex + 22, style5, 0, 24, true);
|
||
|
||
//设置行高
|
||
ws.GetRow(rowIndex + 8).HeightInPoints = 30f;
|
||
ws.GetRow(rowIndex + 9).HeightInPoints = 30f;
|
||
ws.GetRow(rowIndex + 10).HeightInPoints = 40f;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 8, rowIndex + 10, 0, 0));
|
||
ws.GetRow(rowIndex + 8).GetCell(0).SetCellValue("序号\nS/N");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 8, rowIndex + 10, 1, 5));
|
||
ws.GetRow(rowIndex + 8).GetCell(1).SetCellValue("图纸号\nDrawing No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 8, rowIndex + 10, 6, 6));
|
||
ws.GetRow(rowIndex + 8).GetCell(6).SetCellValue("版本\nRev No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 8, rowIndex + 10, 7, 15));
|
||
ws.GetRow(rowIndex + 8).GetCell(7).SetCellValue("尾项描述\nPunch Description");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 8, rowIndex + 10, 16, 16));
|
||
ws.GetRow(rowIndex + 8).GetCell(16).SetCellValue("尾项类别\n* Punch Category");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 8, rowIndex + 9, 17, 18));
|
||
ws.GetRow(rowIndex + 8).GetCell(17).SetCellValue("提出人\nOriginator");
|
||
ws.GetRow(rowIndex + 10).GetCell(17).SetCellValue("姓名\nName");
|
||
ws.GetRow(rowIndex + 10).GetCell(18).SetCellValue("单位\nCompany");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 8, rowIndex + 8, 19, 24));
|
||
ws.GetRow(rowIndex + 8).GetCell(19).SetCellValue("尾项关闭\nRemedial Acceptance and Signature");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 9, rowIndex + 9, 19, 20));
|
||
ws.GetRow(rowIndex + 9).GetCell(19).SetCellValue("CC7");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 9, rowIndex + 9, 21, 22));
|
||
ws.GetRow(rowIndex + 9).GetCell(21).SetCellValue("Worley/BASF");
|
||
|
||
ws.GetRow(rowIndex + 10).GetCell(19).SetCellValue("签名\nSign");
|
||
ws.GetRow(rowIndex + 10).GetCell(20).SetCellValue("日期Date");
|
||
ws.GetRow(rowIndex + 10).GetCell(21).SetCellValue("签名\nSign");
|
||
ws.GetRow(rowIndex + 10).GetCell(22).SetCellValue("日期Date");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 9, rowIndex + 10, 23, 24));
|
||
ws.GetRow(rowIndex + 9).GetCell(23).SetCellValue("Remark");
|
||
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 12;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 12 : ((num - 2) * 12) + 12;
|
||
dEnd = ((num - 1) * 12) + 12;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int j = 0;
|
||
for (int i = 11; i < 23; i++)
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 17f;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 1, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 7, 15));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 23, 24));
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
var dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(1).SetCellValue(dr["PTP_ID"].ToString());
|
||
}
|
||
j++;
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
var style6 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 8, false, false, "Arial Unicode MS");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 23, rowIndex + 27, style6, 0, 24, true);
|
||
|
||
ws.GetRow(rowIndex + 23).HeightInPoints = 8f;
|
||
for (int i = 24; i < 28; i++)
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 10f;
|
||
}
|
||
ws.GetRow(rowIndex + 24).GetCell(0).SetCellValue("LEGEND");
|
||
ws.GetRow(rowIndex + 24).GetCell(1).SetCellValue(" N.A.: Not Applicable");
|
||
ws.GetRow(rowIndex + 24).GetCell(10).SetCellValue("*PUNCH CATEGORY:");
|
||
ws.GetRow(rowIndex + 25).GetCell(11).SetCellValue("A - PUNCH ITEM MUST BE COMPLETED BEFORE TESTING.");
|
||
ws.GetRow(rowIndex + 26).GetCell(11).SetCellValue("B - PUNCH ITEM TO BE COMPLETED AFTER TESTING BUT SHALL BE COMPLETED PRIOR TO SYSTEM TURN-OVER");
|
||
ws.GetRow(rowIndex + 27).GetCell(11).SetCellValue("C - PUNCH ITEM TO BE COMPLETED AFTER SYSTEM TURNOVER.");
|
||
|
||
//划线
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex, rowIndex + 23, 24, 24), ws);
|
||
#endregion
|
||
|
||
rowIndex += 28;
|
||
|
||
}
|
||
|
||
ws.PrintSetup.Landscape = true;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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);
|
||
}
|
||
|
||
//28-TP-12-试压用水(工具)检查清单UG-FW-001
|
||
private void template28(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
//插入图片部分
|
||
var img1 = Server.MapPath("~/res/images/bsf/1.png");
|
||
var img2 = Server.MapPath("~/res/images/bsf/2.png");
|
||
var img3 = Server.MapPath("~/res/images/bsf/3.png");
|
||
var img4 = Server.MapPath("~/res/images/bsf/4.png");
|
||
|
||
//模拟数据
|
||
string sql = @"select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User union all select '模拟数据' as PTP_ID, '' as TestPackageNo, '' WorkAreaId, '' WorkAreaCode, '' PipelineId, '' PipelineCode, '' SystemNumber, '' as TestHeat, '' as TestType, '' SingleNumber, '' DrawingsNum, '' as Remark, '' as PageNum from Sys_User";
|
||
SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID) };
|
||
var dt = SQLHelper.GetDataTableRunText(sql, parms);
|
||
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 25 ? 1 : Math.Ceiling((float)(tbNum - 25) / 25) + 1;
|
||
|
||
int rowIndex = 0;
|
||
for (int num = 1; num <= pageNum; num++)
|
||
{
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 14, style, 0, 17, true);
|
||
ws.GetRow(rowIndex).GetCell(15).SetCellValue("Form No.");
|
||
ws.GetRow(rowIndex).GetCell(16).SetCellValue("TP-06");
|
||
//设置列宽度
|
||
ws.SetColumnWidth(0, 1 * 256);//A
|
||
ws.SetColumnWidth(1, 1 * 256);//B
|
||
ws.SetColumnWidth(2, 4 * 256);//C
|
||
ws.SetColumnWidth(3, 5 * 256);//D
|
||
ws.SetColumnWidth(4, 5 * 256);//E
|
||
ws.SetColumnWidth(5, 2 * 256);//F
|
||
ws.SetColumnWidth(6, 5 * 256);//G
|
||
ws.SetColumnWidth(7, 6 * 256);//H
|
||
ws.SetColumnWidth(8, 6 * 256);//I
|
||
ws.SetColumnWidth(9, 6 * 256);//J
|
||
ws.SetColumnWidth(10, 6 * 256);//K
|
||
ws.SetColumnWidth(11, 6 * 256);//L
|
||
ws.SetColumnWidth(12, 1 * 256);//M
|
||
ws.SetColumnWidth(13, 7 * 256);//N
|
||
ws.SetColumnWidth(14, 5 * 256);//O
|
||
ws.SetColumnWidth(15, 9 * 256);//P
|
||
ws.SetColumnWidth(16, 9 * 256);//Q
|
||
ws.SetColumnWidth(17, 1 * 256);//R
|
||
//设置前3行高度
|
||
ws.GetRow(rowIndex + 0).HeightInPoints = 15f;
|
||
ws.GetRow(rowIndex + 1).HeightInPoints = 15f;
|
||
ws.GetRow(rowIndex + 2).HeightInPoints = 14f;
|
||
|
||
//设置3-15行的行高度
|
||
for (int i = rowIndex + 3; i < rowIndex + 15; i++)
|
||
{
|
||
ws.GetRow(i).HeightInPoints = 18f;
|
||
}
|
||
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex, rowIndex, 1, 1), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 17), ws);
|
||
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 16, 16), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 17, 17), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 1, rowIndex + 1, 2, 16), ws);
|
||
RegionUtil.SetBorderTop(2, new CellRangeAddress(rowIndex + 2, rowIndex + 2, 2, 16), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 1, rowIndex + 14, 0, 0), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 1, 1), ws);
|
||
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 16, 16), ws);
|
||
RegionUtil.SetBorderRight(2, new CellRangeAddress(rowIndex + 2, rowIndex + 14, 17, 17), ws);
|
||
|
||
|
||
RegionUtil.SetBorderLeft(2, new CellRangeAddress(rowIndex + 9, rowIndex + 14, 2, 2), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 7, rowIndex + 7, 2, 16), ws);
|
||
RegionUtil.SetBorderBottom(2, new CellRangeAddress(rowIndex + 8, rowIndex + 8, 2, 16), ws);
|
||
//插入图片
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 2, rowIndex + 4, 3, img1, 1.2, 1.8);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 3, rowIndex + 4, 4, img2, 1.9, 1.9);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 13, rowIndex + 4, 14, img3, 1.5, 1.5);
|
||
InsertImage(hssfworkbook, ws, rowIndex + 3, 15, rowIndex + 4, 16, img4, 1.5, 1.5);
|
||
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("巴斯夫(广东)一体化项目");
|
||
var setStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
ws.GetRow(rowIndex + 3).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 13));
|
||
ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue("BASF (GUANGDONG) INTEGRATED PROJECT");
|
||
ws.GetRow(rowIndex + 4).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 5, 13));
|
||
ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue("试压用水(工具)检查清单");
|
||
ws.GetRow(rowIndex + 5).GetCell(5).CellStyle = setStyle;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 13));
|
||
ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue("WATER(MACHINE) CALIBREATION LIST");
|
||
ws.GetRow(rowIndex + 6).GetCell(5).CellStyle = setStyle;
|
||
|
||
var cellStyle2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 11, false, false, "Arial Unicode MS");
|
||
ws.GetRow(rowIndex + 9).GetCell(2).SetCellValue("Test Package No");
|
||
ws.GetRow(rowIndex + 9).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 9).GetCell(5).SetCellValue(info?.testpackageNo);
|
||
ws.GetRow(rowIndex + 9).GetCell(5).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 9).GetCell(9).SetCellValue("Area");
|
||
ws.GetRow(rowIndex + 9).GetCell(9).CellStyle = cellStyle2;
|
||
ws.GetRow(rowIndex + 9).GetCell(13).SetCellValue(info?.workAreaCode);
|
||
|
||
ws.GetRow(rowIndex + 10).GetCell(2).SetCellValue("试压包号");
|
||
ws.GetRow(rowIndex + 10).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 10).GetCell(9).SetCellValue("区域");
|
||
ws.GetRow(rowIndex + 10).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(2).SetCellValue("System No");
|
||
ws.GetRow(rowIndex + 11).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(5).SetCellValue(info?.SystemNo);
|
||
ws.GetRow(rowIndex + 11).GetCell(5).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(9).SetCellValue("Test Pressure");
|
||
ws.GetRow(rowIndex + 11).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 11).GetCell(13).SetCellValue(info?.TestPressure);
|
||
ws.GetRow(rowIndex + 11).GetCell(13).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 12).GetCell(2).SetCellValue("系统号");
|
||
ws.GetRow(rowIndex + 12).GetCell(2).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 12).GetCell(9).SetCellValue("试验压力");
|
||
ws.GetRow(rowIndex + 12).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 13).GetCell(9).SetCellValue("Test Type");
|
||
ws.GetRow(rowIndex + 13).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 13).GetCell(13).SetCellValue(info?.TestType);
|
||
ws.GetRow(rowIndex + 13).GetCell(13).CellStyle = cellStyle2;
|
||
|
||
ws.GetRow(rowIndex + 14).GetCell(9).SetCellValue("试验方式");
|
||
ws.GetRow(rowIndex + 14).GetCell(9).CellStyle = cellStyle2;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 5, 13));
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 11, true, false, "Arial Unicode MS");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 15, rowIndex + 40, style, 0, 17, true);
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (num == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 25;
|
||
}
|
||
else
|
||
{
|
||
dStart = num == 2 ? 25 : ((num - 2) * 25) + 25;
|
||
dEnd = ((num - 1) * 25) + 25;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int j = 0;
|
||
for (int i = 15; i <= 40; i++)
|
||
{
|
||
ws.GetRow(rowIndex + i).HeightInPoints = 18f;
|
||
ws.GetRow(rowIndex + i).GetCell(0).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None);
|
||
ws.GetRow(rowIndex + i).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
ws.GetRow(rowIndex + i).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 3, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 6, 8));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 9, 12));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 13, 14));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 15, 16));
|
||
|
||
if (i > 15)
|
||
{
|
||
if (pageTb.Rows.Count > j)
|
||
{
|
||
var dr = pageTb.Rows[j];
|
||
ws.GetRow(rowIndex + i).GetCell(3).SetCellValue(dr["PTP_ID"].ToString());
|
||
}
|
||
j++;
|
||
}
|
||
}
|
||
ws.GetRow(rowIndex + 15).HeightInPoints = 30f;
|
||
//数据表头部分
|
||
ws.GetRow(rowIndex + 15).GetCell(2).SetCellValue("No\r\n序号");
|
||
ws.GetRow(rowIndex + 15).GetCell(3).SetCellValue("Report Name\r\n报告名称");
|
||
ws.GetRow(rowIndex + 15).GetCell(6).SetCellValue("Report No.\r\n报告编号");
|
||
ws.GetRow(rowIndex + 15).GetCell(9).SetCellValue("Date of Issue report\r\n报告出具日期");
|
||
ws.GetRow(rowIndex + 15).GetCell(13).SetCellValue("Expiry Date\r\n有效期");
|
||
ws.GetRow(rowIndex + 15).GetCell(15).SetCellValue("Remark\r\n备注");
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
//此处的尾部行数需要根据 得到的动态数据量 来计算,默认写死从50行开始。
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 41, rowIndex + 46, style, 0, 17, true);
|
||
for (int i = rowIndex + 41; i <= rowIndex + 46; i++)
|
||
{
|
||
ws.GetRow(i).HeightInPoints = 14f;
|
||
ws.GetRow(i).GetCell(0).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.Medium);
|
||
ws.GetRow(i).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.Medium);
|
||
ws.GetRow(i).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium);
|
||
}
|
||
|
||
for (int i = 2; i < 17; i++)
|
||
{
|
||
ws.GetRow(rowIndex + 46).GetCell(i).CellStyle = SetStyle(hssfworkbook, BorderStyle.Medium, BorderStyle.Medium, BorderStyle.None, BorderStyle.None);
|
||
}
|
||
ws.GetRow(rowIndex + 46).GetCell(1).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.Medium, BorderStyle.Medium, BorderStyle.None);
|
||
ws.GetRow(rowIndex + 46).GetCell(16).CellStyle = SetStyle(hssfworkbook, BorderStyle.Medium, BorderStyle.Medium, BorderStyle.None, BorderStyle.None);
|
||
ws.GetRow(rowIndex + 46).GetCell(17).CellStyle = SetStyle(hssfworkbook, BorderStyle.None, BorderStyle.Medium, BorderStyle.None, BorderStyle.Medium);
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 41, rowIndex + 43, 2, 4));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 41, rowIndex + 43, 5, 6));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 41, rowIndex + 43, 7, 9));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 41, rowIndex + 43, 10, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 41, rowIndex + 43, 14, 16));
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 44, rowIndex + 44, 2, 4));
|
||
ws.GetRow(rowIndex + 44).GetCell(2).SetCellValue("PREPARED");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 44, rowIndex + 44, 5, 6));
|
||
ws.GetRow(rowIndex + 44).GetCell(5).SetCellValue("REVIEW");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 44, rowIndex + 45, 7, 9));
|
||
ws.GetRow(rowIndex + 44).GetCell(7).SetCellValue("JIANLI");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 44, rowIndex + 45, 10, 13));
|
||
ws.GetRow(rowIndex + 44).GetCell(10).SetCellValue("Worley");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 44, rowIndex + 45, 14, 16));
|
||
ws.GetRow(rowIndex + 44).GetCell(14).SetCellValue("BASF");
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 45, rowIndex + 45, 2, 6));
|
||
ws.GetRow(rowIndex + 45).GetCell(2).SetCellValue("CC7");
|
||
|
||
#endregion
|
||
|
||
rowIndex += 47;
|
||
|
||
}
|
||
|
||
ws.PrintSetup.Landscape = false;
|
||
ws.ForceFormulaRecalculation = true;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
//垂直水平居中
|
||
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.VerticallyCenter = true;
|
||
//ws.HorizontallyCenter = true;
|
||
////打印边距设置 厘米/3
|
||
//ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
|
||
//ws.SetMargin(MarginType.LeftMargin, (double)2.9 / 3);
|
||
//ws.SetMargin(MarginType.TopMargin, (double)2.4 / 3);
|
||
//ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
|
||
////页眉页脚间距
|
||
//ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
//ws.SetMargin(MarginType.FooterMargin, 0);
|
||
|
||
}
|
||
|
||
//32-管道系统压力试验记录SHT 3503-J406-2
|
||
private void template32(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
int rowIndex = 0;
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 2, style, 0, 8, true);
|
||
//设置行高度
|
||
ws.GetRow(rowIndex).Height = 20 * 20 * 6;
|
||
ws.GetRow(rowIndex + 1).Height = 20 * 20 * 2;
|
||
ws.GetRow(rowIndex + 2).Height = 20 * 20 * 2;
|
||
|
||
//设置列宽度
|
||
ws.SetColumnWidth(0, 24 * 256);
|
||
ws.SetColumnWidth(1, 9 * 256);
|
||
ws.SetColumnWidth(2, 9 * 256);
|
||
ws.SetColumnWidth(3, 9 * 256);
|
||
ws.SetColumnWidth(4, 9 * 256);
|
||
ws.SetColumnWidth(5, 9 * 256);
|
||
ws.SetColumnWidth(6, 9 * 256);
|
||
ws.SetColumnWidth(7, 9 * 256);
|
||
ws.SetColumnWidth(8, 9 * 256);
|
||
|
||
//合并单元格和填充文本
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3503—J406-2");
|
||
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
style1.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 1, 5));
|
||
ws.GetRow(rowIndex).GetCell(1).CellStyle = style1;
|
||
ws.GetRow(rowIndex).GetCell(1).SetCellValue("管道系统压力试验记录\nPiping System Pressure Test Record");
|
||
|
||
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, true, false, "Arial Unicode MS");
|
||
style2.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 6, 8));
|
||
ws.GetRow(rowIndex).GetCell(6).CellStyle = style2;
|
||
ws.GetRow(rowIndex).GetCell(6).SetCellValue($"项目名称:{info?.projectName}\n Project Name:{info?.enProjectName}\n 单位名称:{info?.workAreaName}\n Unit Name:{info?.enWorkAreaName}");
|
||
|
||
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("系统名称\nSystem Description");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 1, 3));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 4, 5));
|
||
ws.GetRow(rowIndex + 1).GetCell(4).SetCellValue("系统编号\nSystem No.");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 1, 6, 8));
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 8));
|
||
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("试验记录\nTest Record");
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 3, rowIndex + 15, style, 0, 8, true);
|
||
|
||
//设置行高
|
||
ws.GetRow(rowIndex + 3).Height = 20 * 20 * 5;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1));
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("管道编号/单线号\nPiping No./ Line No.");
|
||
ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue("设计压力\nDesign Pressure Mpa");
|
||
ws.GetRow(rowIndex + 3).GetCell(3).SetCellValue("设计温度\nDesign Temperature ℃");
|
||
ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("试验环境温度\nTest Ambient Temperature ℃");
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("试验介质\nTest Medium");
|
||
ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("试验介质温度\nTest Medium Temperature ℃");
|
||
ws.GetRow(rowIndex + 3).GetCell(7).SetCellValue("试验压力\nTest Pressure Mpa");
|
||
ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue("稳压时间\nHolding Time min");
|
||
for (int i = 4; i < 16; i++)
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 38 * 20;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 0, 1));
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 16, rowIndex + 23, style, 0, 8, true);
|
||
|
||
//设置行高
|
||
ws.GetRow(rowIndex + 16).Height = 50 * 20;
|
||
ws.GetRow(rowIndex + 17).Height = 50 * 20;
|
||
ws.GetRow(rowIndex + 23).Height = 150 * 20;
|
||
//合并单元格填充文本数据
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 0, 8));
|
||
ws.GetRow(rowIndex + 16).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 16).GetCell(0).SetCellValue("试验结论:\nConclusion");
|
||
|
||
for (int i = 17; i < 19; i++)
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 2, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 6, 8));
|
||
}
|
||
ws.GetRow(rowIndex + 17).GetCell(0).SetCellValue("建设/监理单位\nOwner/Construction Supervision Contractor");
|
||
ws.GetRow(rowIndex + 17).GetCell(2).SetCellValue("总承包单位\nGeneral Contractor");
|
||
ws.GetRow(rowIndex + 17).GetCell(6).SetCellValue("施工单位\nConstruction Company");
|
||
|
||
ws.GetRow(rowIndex + 23).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 23).GetCell(0).SetCellValue(" 专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date:");
|
||
ws.GetRow(rowIndex + 23).GetCell(2).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 23).GetCell(2).SetCellValue(" 专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date:");
|
||
ws.GetRow(rowIndex + 23).GetCell(6).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 23).GetCell(6).SetCellValue(" 专业工程师\n Discipline Engineer: \n\n 质量检查员:\n Quality Inspector:\n\n 班(组)长:\n Leader:\n\n 日期Date:");
|
||
|
||
#endregion
|
||
|
||
ws.PrintSetup.FitWidth = 1;
|
||
ws.PrintSetup.FitHeight = 0;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
|
||
ws.FitToPage = true;
|
||
|
||
//垂直水平居中
|
||
ws.VerticallyCenter = true;
|
||
ws.HorizontallyCenter = true;
|
||
//打印边距设置 厘米/3
|
||
ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
|
||
ws.SetMargin(MarginType.LeftMargin, (double)2.9 / 3);
|
||
ws.SetMargin(MarginType.TopMargin, (double)2.4 / 3);
|
||
ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
|
||
|
||
//页眉页脚间距
|
||
ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
ws.SetMargin(MarginType.FooterMargin, 0);
|
||
|
||
}
|
||
|
||
//33-管道吹扫清洗记录SHT 3503-J408 UG-FW-001
|
||
private void template33(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
int rowIndex = 0;
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
string sql = @"select
|
||
a.PTP_ID,
|
||
a.TestPackageNo,
|
||
a.OperationMedium,
|
||
a.PurgingMedium,
|
||
a.CleaningMedium,
|
||
'' as SubSystemName,
|
||
'' as SubSystemNo,
|
||
b.PipelineId,
|
||
(select PipelineCode from Pipeline_Pipeline where PipelineId=b.PipelineId) as PipelineCode,
|
||
(select d.MaterialCode from Pipeline_Pipeline as c inner join Base_Material as d on c.MainMaterialId=d.MaterialId
|
||
where PipelineId=b.PipelineId ) as MaterialCode,
|
||
e.ProjectName,
|
||
e.EnProjectName,
|
||
(select UnitName from Base_Unit where UnitId=a.UnitId) as UnitName,
|
||
(select UnitCode from Base_Unit where UnitId=a.UnitId) as UnitCode
|
||
from PTP_TestPackage as a inner join
|
||
PTP_PipelineList as b on a.PTP_ID=b.PTP_ID
|
||
left join Base_Project as e on a.ProjectId=e.ProjectId
|
||
where a.PTP_ID=@PTP_ID and a.projectId=@projectId
|
||
";
|
||
|
||
SqlParameter[] parmas =
|
||
{
|
||
new SqlParameter("@projectId",this.CurrUser.LoginProjectId),
|
||
new SqlParameter("@PTP_ID",tvControlItem.SelectedNodeID)
|
||
};
|
||
DataTable dt = SQLHelper.GetDataTableRunText(sql, parmas);
|
||
var tbNum = dt.Rows.Count;
|
||
var pageNum = tbNum < 16 ? 1
|
||
: Math.Ceiling((float)(tbNum - 16) / 16) + 1;
|
||
|
||
|
||
for (int i = 1; i <= pageNum; i++)
|
||
{
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 9, style, 0, 6, true);
|
||
//设置头部行高
|
||
ws.GetRow(rowIndex).Height = 13 * 20;
|
||
ws.GetRow(rowIndex + 1).Height = 22 * 20;
|
||
ws.GetRow(rowIndex + 2).Height = 56 * 20;
|
||
ws.GetRow(rowIndex + 3).Height = 12 * 20;
|
||
ws.GetRow(rowIndex + 4).Height = 12 * 20;
|
||
ws.GetRow(rowIndex + 5).Height = 27 * 20;
|
||
ws.GetRow(rowIndex + 6).Height = 26 * 20;
|
||
ws.GetRow(rowIndex + 7).Height = 36 * 20;
|
||
ws.GetRow(rowIndex + 8).Height = 26 * 20;
|
||
ws.GetRow(rowIndex + 9).Height = 26 * 20;
|
||
//设置列宽
|
||
ws.SetColumnWidth(0, 19 * 256);
|
||
ws.SetColumnWidth(1, 9 * 256);
|
||
ws.SetColumnWidth(2, 16 * 256);
|
||
ws.SetColumnWidth(3, 15 * 256);
|
||
ws.SetColumnWidth(4, 11 * 256);
|
||
ws.SetColumnWidth(5, 5 * 256);
|
||
ws.SetColumnWidth(6, 9 * 256);
|
||
|
||
//合并单元格和填充单元格值
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 0, rowIndex + 2, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 0, rowIndex + 2, 2, 3));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 0, rowIndex + 2, 4, 6));
|
||
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3503-J408");
|
||
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 11, true, true, "Arial");
|
||
style1.WrapText = true;
|
||
ws.GetRow(rowIndex).GetCell(2).CellStyle = style1;
|
||
ws.GetRow(rowIndex).GetCell(2).SetCellValue("管道吹扫/清洗检验记录(I)\nPipline Flushing and Blowing Inspection Record(I)");
|
||
|
||
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, true, false, "Arial");
|
||
style2.WrapText = true;
|
||
ws.GetRow(rowIndex).GetCell(4).CellStyle = style2;
|
||
ws.GetRow(rowIndex).GetCell(4).SetCellValue($"项目名称:{info?.projectName}\nProject Name:{info?.enProjectName}\n单位名称:{info?.workAreaName}\n Unit Name:{info?.enWorkAreaName}");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 3));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 4, 6));
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 2, 3));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 4, 6));
|
||
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("子系统名称 Subsystem Name");
|
||
ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue("子系统编号 Subsystem No.");
|
||
ws.GetRow(rowIndex + 3).GetCell(4).SetCellValue("试压包号 Test Package No.");
|
||
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("");
|
||
ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue("");
|
||
ws.GetRow(rowIndex + 4).GetCell(4).SetCellValue(info?.testpackageNo);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 5, rowIndex + 5, 0, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 6, rowIndex + 6, 0, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 0, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 8, rowIndex + 8, 0, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 9, rowIndex + 9, 0, 5));
|
||
|
||
ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("检查项目及要求\nInspection items and requirements");
|
||
ws.GetRow(rowIndex + 5).GetCell(6).SetCellValue("检查结果\nResult");
|
||
|
||
|
||
var style3 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 9, true, false, "Arial");
|
||
ws.GetRow(rowIndex + 6).GetCell(0).CellStyle = style3;
|
||
ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("管线压力试验检查合格。Pipeline pressure test is acceptable.");
|
||
|
||
ws.GetRow(rowIndex + 7).GetCell(0).CellStyle = style3;
|
||
ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("与吹扫及清洗无关的安全附件和仪表元件已经拆除或按要求隔离。Safety attachments and instruments not involved in purging and cleaning have been dismantled or isolated as per requirement.");
|
||
|
||
ws.GetRow(rowIndex + 8).GetCell(0).CellStyle = style3;
|
||
ws.GetRow(rowIndex + 8).GetCell(0).SetCellValue("管线系统内阀门已按要求开启。All piping system valves have been opened.");
|
||
|
||
ws.GetRow(rowIndex + 9).GetCell(0).CellStyle = style3;
|
||
ws.GetRow(rowIndex + 9).GetCell(0).SetCellValue("不锈钢管线系统清洗用水应符合规范要求。Test use water of stainless steel pipeline shall be in compliance with specification.");
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
var style4 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 10, rowIndex + 26, style4, 0, 6, true);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 10, rowIndex + 10, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 10, rowIndex + 10, 5, 6));
|
||
ws.GetRow(rowIndex + 10).GetCell(0).SetCellValue("管道编号\nPipeline No.");
|
||
ws.GetRow(rowIndex + 10).GetCell(2).SetCellValue("管线材质\nMaterial");
|
||
ws.GetRow(rowIndex + 10).GetCell(3).SetCellValue("操作介质\nOperation Medium");
|
||
ws.GetRow(rowIndex + 10).GetCell(4).SetCellValue("吹扫介质\nBlowing Meadium");
|
||
ws.GetRow(rowIndex + 10).GetCell(5).SetCellValue("清洗介质\nFlushing Medium");
|
||
var dataTit = rowIndex + 11;
|
||
|
||
var dStart = 0;
|
||
var dEnd = 0;
|
||
if (i == 1)
|
||
{
|
||
dStart = 0;
|
||
dEnd = 15;
|
||
}
|
||
else
|
||
{
|
||
dStart = i == 2 ? 15 : ((i - 2) * 15) + 15;
|
||
dEnd = ((i - 1) * 15) + 15;
|
||
}
|
||
var pageTb = GetPageToTable(dt, dStart, dEnd);
|
||
int j = 0;
|
||
for (int k = rowIndex + 11; k <= rowIndex + 26; k++)
|
||
{
|
||
ws.GetRow(k).Height = 20 * 20;
|
||
ws.AddMergedRegion(new CellRangeAddress(k, k, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(k, k, 5, 6));
|
||
}
|
||
foreach (DataRow dr in pageTb.Rows)
|
||
{
|
||
int dataIndex = dataTit + j;
|
||
ws.GetRow(dataIndex).GetCell(0).SetCellValue(dr["PipelineCode"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(2).SetCellValue(dr["MaterialCode"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(3).SetCellValue(dr["OperationMedium"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(4).SetCellValue(dr["PurgingMedium"].ToString());
|
||
ws.GetRow(dataIndex).GetCell(5).SetCellValue(dr["CleaningMedium"].ToString());
|
||
j++;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 27, rowIndex + 34, style, 0, 6, true);
|
||
|
||
//合并单元格合和填充值
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 27, rowIndex + 27, 0, 6));
|
||
ws.GetRow(rowIndex + 27).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 27).GetCell(0).SetCellValue("检验方法及结果:\nInspection method and conclusion:");
|
||
ws.GetRow(rowIndex + 27).Height = 32 * 20;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 28, rowIndex + 29, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 28, rowIndex + 29, 2, 3));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 28, rowIndex + 29, 4, 6));
|
||
|
||
ws.GetRow(rowIndex + 29).GetCell(0).SetCellValue("建设/监理单位\nOwner/Construction Supervision Contractor");
|
||
ws.GetRow(rowIndex + 29).GetCell(2).SetCellValue("总承包单位\nGeneral Contractor");
|
||
ws.GetRow(rowIndex + 29).GetCell(4).SetCellValue("施工单位\nConstruction Company");
|
||
ws.GetRow(rowIndex + 28).Height = 13 * 20;
|
||
ws.GetRow(rowIndex + 29).Height = 13 * 20;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 30, rowIndex + 34, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 30, rowIndex + 34, 2, 3));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 30, rowIndex + 34, 4, 6));
|
||
|
||
ws.GetRow(rowIndex + 30).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 30).GetCell(0).SetCellValue(" 专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date:\n\n");
|
||
ws.GetRow(rowIndex + 30).GetCell(2).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 30).GetCell(2).SetCellValue(" 专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date:\n\n");
|
||
ws.GetRow(rowIndex + 30).GetCell(4).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 30).GetCell(4).SetCellValue(" 专业工程师\n Discipline Engineer: \n\n 质量检查员:\n Quality Inspector:\n\n 班(组)长:\n Leader:\n\n 日期Date:\n\n");
|
||
|
||
ws.GetRow(rowIndex + 30).Height = 40 * 20;
|
||
ws.GetRow(rowIndex + 31).Height = 24 * 20;
|
||
ws.GetRow(rowIndex + 32).Height = 16 * 20;
|
||
ws.GetRow(rowIndex + 33).Height = 26 * 20;
|
||
ws.GetRow(rowIndex + 34).Height = 33 * 20;
|
||
#endregion
|
||
|
||
rowIndex = rowIndex + 12;
|
||
}
|
||
|
||
|
||
ws.PrintSetup.FitWidth = 1;
|
||
ws.PrintSetup.FitHeight = 0;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
|
||
ws.FitToPage = true;
|
||
|
||
//垂直水平居中
|
||
ws.VerticallyCenter = true;
|
||
ws.HorizontallyCenter = true;
|
||
//打印边距设置 厘米/3
|
||
ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
|
||
ws.SetMargin(MarginType.LeftMargin, (double)2.9 / 3);
|
||
ws.SetMargin(MarginType.TopMargin, (double)2.4 / 3);
|
||
ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
|
||
|
||
//页眉页脚间距
|
||
ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
ws.SetMargin(MarginType.FooterMargin, 0);
|
||
|
||
}
|
||
|
||
//34-管道系统压力试验条件确认记录SHT 3503-J406-1
|
||
private void template34(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
int rowIndex = 0;
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 5, style, 0, 8, true);
|
||
|
||
//循环设置表头高度
|
||
for (int i = 0; i < 6; i++)
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 20 * 20;
|
||
}
|
||
//设置每列的宽度
|
||
ws.SetColumnWidth(0, 19 * 256);
|
||
ws.SetColumnWidth(1, 9 * 256);
|
||
ws.SetColumnWidth(2, 9 * 256);
|
||
ws.SetColumnWidth(3, 9 * 256);
|
||
ws.SetColumnWidth(4, 9 * 256);
|
||
ws.SetColumnWidth(5, 9 * 256);
|
||
ws.SetColumnWidth(6, 9 * 256);
|
||
ws.SetColumnWidth(7, 9 * 256);
|
||
ws.SetColumnWidth(8, 9 * 256);
|
||
|
||
//合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex + 3, 0, 0));
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T 3503—J406-1");
|
||
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 14, true, true, "Arial Unicode MS");
|
||
style1.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex + 3, 1, 5));
|
||
ws.GetRow(rowIndex).GetCell(1).CellStyle = style1;
|
||
ws.GetRow(rowIndex).GetCell(1).SetCellValue("管道系统压力试验条件确认记录\nPiping System Pressure Test Condition Confirmation Record");
|
||
|
||
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, true, false, "Arial Unicode MS");
|
||
style2.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex + 3, 6, 8));
|
||
ws.GetRow(rowIndex).GetCell(6).CellStyle = style2;
|
||
ws.GetRow(rowIndex).GetCell(6).SetCellValue($"工程名称:{info?.projectName}\n Project Name:{info?.enProjectName}\n 单位工程名称:{info?.workAreaName}\n Unit Name:{info?.enWorkAreaName}");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 0, 0));
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("系统名称\nSystem Description");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 1, 3));
|
||
ws.GetRow(rowIndex + 4).GetCell(1).SetCellValue("");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 4, 5));
|
||
ws.GetRow(rowIndex + 4).GetCell(4).SetCellValue("系统编号\nSystem No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 5, 6, 8));
|
||
ws.GetRow(rowIndex + 4).GetCell(6).SetCellValue(info?.SystemNo);
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 6, rowIndex + 19, style, 0, 8, true);
|
||
//循环设置高度和合并单元格
|
||
for (int i = 6; i < 20; i++)
|
||
{
|
||
if (i == 13)
|
||
ws.GetRow(rowIndex + i).Height = 43 * 20;
|
||
else
|
||
ws.GetRow(rowIndex + i).Height = 42 * 20;
|
||
if (i == 6)
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 0, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 8, 8));
|
||
continue;
|
||
}
|
||
if (i == 7)
|
||
continue;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 0, 7));
|
||
}
|
||
ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("检查项目与要求\nInspection Item and Requirement");
|
||
ws.GetRow(rowIndex + 6).GetCell(8).SetCellValue("检查结果\nInspection Result");
|
||
ws.GetRow(rowIndex + 8).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 8).GetCell(0).SetCellValue("管道安装符合最新设计文件和规范要求。Pipe installation must be in compliance with latest design documents and specification.");
|
||
ws.GetRow(rowIndex + 9).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 9).GetCell(0).SetCellValue("管道组成件复验合格。Pipline components have been re-inspected and are accepatble.");
|
||
ws.GetRow(rowIndex + 10).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 10).GetCell(0).SetCellValue("焊接工作记录齐全。Welders complete operation records are available.");
|
||
ws.GetRow(rowIndex + 11).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 11).GetCell(0).SetCellValue("无损检测符合设计文件和规范要求。NDE results must be in compliance with design document and specification.");
|
||
ws.GetRow(rowIndex + 12).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 12).GetCell(0).SetCellValue("热处理结果符合设计文件和规范要求。PWHT results must be in compliance with design document and specification.");
|
||
ws.GetRow(rowIndex + 13).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 13).GetCell(0).SetCellValue("支、吊架安装正确。Support and hangers must be correctly installed.");
|
||
ws.GetRow(rowIndex + 14).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 14).GetCell(0).SetCellValue("合金钢管道材质标记清楚。Identifications on material of alloy steel pipline are clear.");
|
||
ws.GetRow(rowIndex + 15).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 15).GetCell(0).SetCellValue("不参与管道系统试验的 安全附件、仪表已按规定拆除或隔离,参与试压的系统内的阀门已开启。Safety attachments and instruments not involved in test have been dismatled or isolated as requirement, all system valves involved in test have been opened. ");
|
||
ws.GetRow(rowIndex + 16).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 16).GetCell(0).SetCellValue("临时加固措施、盲板位置与标识符和施工方案要求。Temporary reinforcement measures, blind position and markings must be incompliance with Specification.");
|
||
ws.GetRow(rowIndex + 17).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 17).GetCell(0).SetCellValue("焊接接头及需要检验的部位未被覆盖。Welds and other positions to be tested have not yet been painted and heat-insulated.");
|
||
ws.GetRow(rowIndex + 23).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 23).GetCell(0).SetCellValue("试压用压力表量程、精度等级、检定状态符合规范要求。Scale, accuracy and calibration state of test use pressure gauge must be incompliance with specification. ");
|
||
ws.GetRow(rowIndex + 19).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 19).GetCell(0).SetCellValue("不锈钢管道试验用水符合规范要求。Test use water of stainless steel pipline must be incompliance with specification.");
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 20, rowIndex + 22, style, 0, 8, true);
|
||
ws.GetRow(rowIndex + 20).Height = 20 * 20 * 2;
|
||
ws.GetRow(rowIndex + 21).Height = 20 * 20 * 3;
|
||
ws.GetRow(rowIndex + 22).Height = 20 * 20 * 7;
|
||
|
||
//循环合并单元格
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 20, rowIndex + 20, 0, 8));
|
||
for (int i = 21; i < 23; i++)
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 2, 5));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 6, 8));
|
||
}
|
||
|
||
//填充文本
|
||
ws.GetRow(rowIndex + 20).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 20).GetCell(0).SetCellValue("备注:\nRemark");
|
||
|
||
ws.GetRow(rowIndex + 21).GetCell(0).SetCellValue("建设/监理单位\nOwner/Construction Supervision Contractor");
|
||
ws.GetRow(rowIndex + 21).GetCell(2).SetCellValue("总承包单位\nGeneral Contractor");
|
||
ws.GetRow(rowIndex + 21).GetCell(6).SetCellValue("施工单位\nConstruction Company");
|
||
|
||
ws.GetRow(rowIndex + 22).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 22).GetCell(0).SetCellValue(" 专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date:");
|
||
ws.GetRow(rowIndex + 22).GetCell(2).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 22).GetCell(2).SetCellValue(" 专业工程师\n Discipline Engineer: \n\n\n\n\n\n\n\n 日期Date:");
|
||
ws.GetRow(rowIndex + 22).GetCell(6).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 22).GetCell(6).SetCellValue(" 专业工程师\n Discipline Engineer: \n\n 质量检查员:\n Quality Inspector:\n\n 班(组)长:\n Leader:\n\n 日期Date:");
|
||
|
||
|
||
#endregion
|
||
|
||
ws.PrintSetup.FitWidth = 1;
|
||
ws.PrintSetup.FitHeight = 0;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
|
||
ws.FitToPage = true;
|
||
|
||
//垂直水平居中
|
||
ws.VerticallyCenter = true;
|
||
ws.HorizontallyCenter = true;
|
||
//打印边距设置 厘米/3
|
||
ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
|
||
ws.SetMargin(MarginType.LeftMargin, (double)2.9 / 3);
|
||
ws.SetMargin(MarginType.TopMargin, (double)2.4 / 3);
|
||
ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
|
||
|
||
//页眉页脚间距
|
||
ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
ws.SetMargin(MarginType.FooterMargin, 0);
|
||
|
||
}
|
||
|
||
//35-TP-13-管道复位记录UG-FW-001 之 sheet1
|
||
private void template35_sheet1(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
int rowIndex = 0;
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 7, style, 0, 6, true);
|
||
//设置单元格高宽
|
||
ws.GetRow(rowIndex).Height = 100 * 20;
|
||
ws.GetRow(rowIndex + 1).Height = 20 * 20;
|
||
ws.GetRow(rowIndex + 2).Height = 20 * 20;
|
||
ws.GetRow(rowIndex + 3).Height = 40 * 20;
|
||
ws.GetRow(rowIndex + 4).Height = 20 * 20;
|
||
ws.GetRow(rowIndex + 5).Height = 40 * 20;
|
||
ws.GetRow(rowIndex + 6).Height = 20 * 20;
|
||
ws.GetRow(rowIndex + 7).Height = 40 * 20;
|
||
|
||
ws.SetColumnWidth(0, 20 * 256);
|
||
ws.SetColumnWidth(1, 8 * 256);
|
||
ws.SetColumnWidth(2, 15 * 256);
|
||
ws.SetColumnWidth(3, 15 * 256);
|
||
ws.SetColumnWidth(4, 10 * 256);
|
||
ws.SetColumnWidth(5, 8 * 256);
|
||
ws.SetColumnWidth(6, 10 * 256);
|
||
|
||
//合并填充单元格
|
||
for (int i = 0; i < 3; i++)
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 2, 3));
|
||
if (i == 2)
|
||
continue;
|
||
if (i == 0)
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 4, 6));
|
||
else
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 4, 6));
|
||
}
|
||
|
||
ws.GetRow(rowIndex).GetCell(0).SetCellValue("SH/T3503-J408");
|
||
ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("Subsystem Name子系统名称");
|
||
ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("Fire Water");
|
||
|
||
var setStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 12, true, true, "Arial Unicode MS");
|
||
setStyle.WrapText = true;
|
||
ws.GetRow(rowIndex).GetCell(2).CellStyle = setStyle;
|
||
ws.GetRow(rowIndex).GetCell(2).SetCellValue("Pipline Flushing and Blowing \nInspection Record(I)\n管道吹扫/清洗检验记录(I)");
|
||
ws.GetRow(rowIndex + 1).GetCell(2).SetCellValue("Subsystem No.子系统编号");
|
||
ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue("UG-FW");
|
||
|
||
var setStyle2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, false, false, "Arial Unicode MS");
|
||
setStyle2.WrapText = true;
|
||
ws.GetRow(rowIndex).GetCell(4).CellStyle = setStyle2;
|
||
ws.GetRow(rowIndex).GetCell(4).SetCellValue($"Project Name:{info?.enProjectName}\n 项目名称:{info?.projectName}\n Unit Name:{info?.enWorkAreaName}\n 单位名称:{info.workAreaName}");
|
||
ws.GetRow(rowIndex + 1).GetCell(4).SetCellValue(" Test Package No.试压包号");
|
||
|
||
for (int i = 3; i < 8; i++)
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 0, 5));
|
||
}
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("Inspection items and requirements\n检查项目及要求");
|
||
ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("Result\n检查结果");
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("Pipeline pressure test is acceptable.管线压力试验检查合格");
|
||
ws.GetRow(rowIndex + 4).GetCell(0).CellStyle = setStyle2;
|
||
ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("Safety attachments and instruments not involved in purging and cleaning have been dismantled or isolated as per requirement.与吹扫及清洗无关的安全附件和仪表元件已经拆除或按要求隔离");
|
||
ws.GetRow(rowIndex + 5).GetCell(0).CellStyle = setStyle2;
|
||
ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("All piping system valves have been opened.管线系统内阀门已按要求开启");
|
||
ws.GetRow(rowIndex + 6).GetCell(0).CellStyle = setStyle2;
|
||
ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("Test use water of stainless steel pipeline shall be in compliance with specification.不锈钢管线系统清洗用水应符合规范要求");
|
||
ws.GetRow(rowIndex + 7).GetCell(0).CellStyle = setStyle2;
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 8, rowIndex + 24, style, 0, 6, true);
|
||
//设置单元格高度和合并单元格
|
||
for (int i = 8; i < 25; i++)
|
||
{
|
||
if (i == 8)
|
||
ws.GetRow(rowIndex + i).Height = 40 * 20;
|
||
else
|
||
ws.GetRow(rowIndex + i).Height = 20 * 20;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 5, 6));
|
||
}
|
||
ws.GetRow(rowIndex + 8).GetCell(0).SetCellValue("Pipeline No.\n管道编号");
|
||
ws.GetRow(rowIndex + 8).GetCell(2).SetCellValue("Material\n管线材质");
|
||
ws.GetRow(rowIndex + 8).GetCell(3).SetCellValue("Operation Medium\n操作介质");
|
||
ws.GetRow(rowIndex + 8).GetCell(4).SetCellValue("Blowing Meadium\n吹扫介质");
|
||
ws.GetRow(rowIndex + 8).GetCell(5).SetCellValue("Flushing Medium\n清洗介质");
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 25, rowIndex + 27, style, 0, 6, true);
|
||
ws.GetRow(rowIndex + 25).Height = 30 * 20;
|
||
ws.GetRow(rowIndex + 26).Height = 40 * 20;
|
||
ws.GetRow(rowIndex + 27).Height = 125 * 20;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 25, rowIndex + 25, 0, 6));
|
||
ws.GetRow(rowIndex + 25).GetCell(0).CellStyle = setStyle2;
|
||
ws.GetRow(rowIndex + 25).GetCell(0).SetCellValue("Inspection method and conclusion:\n检验方法及结果:");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 26, rowIndex + 26, 0, 1));
|
||
ws.GetRow(rowIndex + 26).GetCell(0).SetCellValue("建设/监理单位\nOwner/Construction Supervision Contractor");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 26, rowIndex + 26, 2, 3));
|
||
ws.GetRow(rowIndex + 26).GetCell(2).SetCellValue("总承包单位\nGeneral Contractor");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 26, rowIndex + 26, 4, 6));
|
||
ws.GetRow(rowIndex + 26).GetCell(4).SetCellValue("施工单位\nConstruction Company");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 27, rowIndex + 27, 0, 1));
|
||
ws.GetRow(rowIndex + 27).GetCell(0).CellStyle = setStyle2;
|
||
ws.GetRow(rowIndex + 27).GetCell(0).SetCellValue(" Discipline Engineer:\n 专业工程师\n\n\n\n\n Date\n 日期:");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 27, rowIndex + 27, 2, 3));
|
||
ws.GetRow(rowIndex + 27).GetCell(2).CellStyle = setStyle2;
|
||
ws.GetRow(rowIndex + 27).GetCell(2).SetCellValue(" Discipline Engineer:\n 专业工程师\n\n\n\n\n Date\n 日期:");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 27, rowIndex + 27, 4, 6));
|
||
ws.GetRow(rowIndex + 27).GetCell(4).CellStyle = setStyle2;
|
||
ws.GetRow(rowIndex + 27).GetCell(4).SetCellValue(" Discipline Engineer:\n 专业工程师:\n Quality Inspector:\n 质量检查员:\n Group Leader:\n 班(组)长∶\n Date\n 日期:");
|
||
#endregion
|
||
|
||
|
||
ws.PrintSetup.FitWidth = 1;
|
||
ws.PrintSetup.FitHeight = 0;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
|
||
ws.FitToPage = true;
|
||
|
||
//垂直水平居中
|
||
ws.VerticallyCenter = true;
|
||
ws.HorizontallyCenter = true;
|
||
//打印边距设置 厘米/3
|
||
ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
|
||
ws.SetMargin(MarginType.LeftMargin, (double)2.9 / 3);
|
||
ws.SetMargin(MarginType.TopMargin, (double)2.4 / 3);
|
||
ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
|
||
|
||
//页眉页脚间距
|
||
ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
ws.SetMargin(MarginType.FooterMargin, 0);
|
||
|
||
}
|
||
|
||
//35-TP-13-管道复位记录UG-FW-001 之 sheet2
|
||
private void template35_sheet2(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
int rowIndex = 0;
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 1, style1, 0, 8, true);
|
||
ws.GetRow(rowIndex).Height = 15 * 20;
|
||
ws.SetColumnWidth(0, 18 * 256);
|
||
ws.SetColumnWidth(1, 4 * 256);
|
||
ws.SetColumnWidth(2, 8 * 256);
|
||
ws.SetColumnWidth(3, 8 * 256);
|
||
ws.SetColumnWidth(4, 8 * 256);
|
||
ws.SetColumnWidth(5, 8 * 256);
|
||
ws.SetColumnWidth(6, 8 * 256);
|
||
ws.SetColumnWidth(7, 9 * 256);
|
||
ws.SetColumnWidth(8, 9 * 256);
|
||
|
||
ws.GetRow(rowIndex).GetCell(7).SetCellValue("Form No.");
|
||
ws.GetRow(rowIndex).GetCell(8).SetCellValue("TP-13");
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 4, style, 0, 8, true);
|
||
|
||
ws.GetRow(rowIndex + 1).Height = 30 * 20;
|
||
ws.GetRow(rowIndex + 2).Height = 60 * 20;
|
||
ws.GetRow(rowIndex + 3).Height = 30 * 20;
|
||
ws.GetRow(rowIndex + 4).Height = 20 * 20;
|
||
|
||
var setStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 12, true, true, "Arial Unicode MS");
|
||
setStyle.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 2, 0, 0));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 2, 1, 5));
|
||
ws.GetRow(rowIndex + 1).GetCell(1).CellStyle = setStyle;
|
||
ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("复位检查\nRe-instatement Certificate");
|
||
|
||
var setStyle2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, false, false, "Arial Unicode MS");
|
||
setStyle2.WrapText = true;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 2, 6, 8));
|
||
ws.GetRow(rowIndex + 1).GetCell(6).CellStyle = setStyle2;
|
||
ws.GetRow(rowIndex + 1).GetCell(6).SetCellValue($"项目名称:{info?.projectName}\nProject Name:{info?.enProjectName}\n单位名称:{info?.workAreaName}\nUnit Name:{info?.enWorkAreaName}");
|
||
|
||
//头部列表部分
|
||
ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("子系统名称 Subsystem Name");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 1, 5));
|
||
ws.GetRow(rowIndex + 3).GetCell(1).SetCellValue("子系统编号 Subsystem No.");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 3, 6, 8));
|
||
ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("试压包号 Test Package No.");
|
||
|
||
ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 1, 5));
|
||
ws.GetRow(rowIndex + 4).GetCell(1).SetCellValue("");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 4, rowIndex + 4, 6, 8));
|
||
ws.GetRow(rowIndex + 4).GetCell(6).SetCellValue(info.testpackageNo);
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 5, rowIndex + 19, style, 0, 8, true);
|
||
for (int i = 5; i < 20; i++)
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 40 * 20;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 0, 6));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 7, 8));
|
||
}
|
||
ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("检查内容\nInspection Items and requirements");
|
||
ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("Results\n检查结果");
|
||
ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("吹扫试压完成后,对管线的干燥情况进行检查。Flushing and hydrostatic testing have been satisfactorily completed and recorded ,Check drying of lines complete.");
|
||
ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("按照P&ID恢复因清洗和试压拆除如调节阀等事项。All items (control valves ,etc.)removed for cleaning and testing have been reinstated as per P&ID.");
|
||
ws.GetRow(rowIndex + 8).GetCell(0).SetCellValue("试压后机械之间连接的正式螺栓垫片,根据要求记录螺栓的扭矩值。Correct bolts,gasket used to reinstate all mechanical joints disturbed post test,torque record available as required. ");
|
||
ws.GetRow(rowIndex + 9).GetCell(0).SetCellValue("所有临时放空及排放已拆除并按图恢复。All temporary vents and drains have been removed,and reinstated in accrodance with drawings.");
|
||
ws.GetRow(rowIndex + 10).GetCell(0).SetCellValue("根据P&ID指示按照正确方向安装管道的原件。Directional sensitive piping elements are all correctly installed as indicated on P&ID.");
|
||
ws.GetRow(rowIndex + 11).GetCell(0).SetCellValue("根据P&ID和图纸正确安装永久插板和盲板。Permanent spectacle and process blinds are in the correct position as indicated on P&ID and drawings. ");
|
||
ws.GetRow(rowIndex + 12).GetCell(0).SetCellValue("正确安装指定阀门的延长手柄和链条。Extended spindles and chain wheels for specified valves have been correctly installed.");
|
||
ws.GetRow(rowIndex + 13).GetCell(0).SetCellValue("All locking devices and interlocks for specified valves have been correctly installed.正确安装指定阀门的锁定装置和联动装置。");
|
||
ws.GetRow(rowIndex + 14).GetCell(0).SetCellValue("按照PID&图纸要求恢复临时拆除的管道、仪表和机械设备。All temporary removed piping,instrumentation,mechanical equipment are re-intated in accordance with the P&ID's and drawings.");
|
||
ws.GetRow(rowIndex + 15).GetCell(0).SetCellValue("所有的阀门涂油脂和试压已经完成。All valves have been greased and stroked.");
|
||
ws.GetRow(rowIndex + 16).GetCell(0).SetCellValue("螺纹连接根据规范要求进行。Compound on screwed connections in accordance with specification.");
|
||
ws.GetRow(rowIndex + 17).GetCell(0).SetCellValue("安装所有的制动装置和联动装置。All locking device/interlocks installed.");
|
||
ws.GetRow(rowIndex + 23).GetCell(0).SetCellValue("检查和确定弹簧支架、滑动支架装置。Spring Support,Gags removed&support settings confirmed/Checked.");
|
||
ws.GetRow(rowIndex + 19).GetCell(0).SetCellValue("如果需要,释放给化学清洗、油洗。System released for chemical cleaning /hot oil flushing ,if required.");
|
||
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 20, rowIndex + 26, style, 0, 8, true);
|
||
ws.GetRow(rowIndex + 20).Height = 40 * 20;
|
||
ws.GetRow(rowIndex + 21).Height = 15 * 20;
|
||
ws.GetRow(rowIndex + 22).Height = 15 * 20;
|
||
ws.GetRow(rowIndex + 23).Height = 15 * 20;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 20, rowIndex + 20, 0, 8));
|
||
ws.GetRow(rowIndex + 20).GetCell(0).CellStyle = setStyle2;
|
||
ws.GetRow(rowIndex + 20).GetCell(0).SetCellValue(" Conclusion:\n 检查结果:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 21, rowIndex + 23, 0, 1));
|
||
ws.GetRow(rowIndex + 21).GetCell(0).SetCellValue("建设/监理单位\nOwner/Construction Supervision\nContractor");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 21, rowIndex + 23, 2, 5));
|
||
ws.GetRow(rowIndex + 21).GetCell(2).SetCellValue("总承包单位\nGeneral Contractor");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 21, rowIndex + 23, 6, 8));
|
||
ws.GetRow(rowIndex + 21).GetCell(6).SetCellValue("施工单位\nConstruction Company");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 24, rowIndex + 26, 0, 1));
|
||
ws.GetRow(rowIndex + 24).GetCell(0).CellStyle = setStyle2;
|
||
ws.GetRow(rowIndex + 24).GetCell(0).SetCellValue(" 专业工程师\n Discipline Engineer:\n\n\n\n\n\n 日期Date: ");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 24, rowIndex + 26, 2, 5));
|
||
ws.GetRow(rowIndex + 24).GetCell(2).CellStyle = setStyle2;
|
||
ws.GetRow(rowIndex + 24).GetCell(2).SetCellValue(" 专业工程师\n Discipline Engineer:\n\n\n\n\n\n 日期Date: ");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 24, rowIndex + 26, 6, 8));
|
||
ws.GetRow(rowIndex + 24).GetCell(6).CellStyle = setStyle2;
|
||
ws.GetRow(rowIndex + 24).GetCell(6).SetCellValue(" 专业工程师\n Discipline Engineer:\n 质量检查员:\n Quality Inspector:\n 班(组)长:\n Leader:\n\n 日期Date: ");
|
||
|
||
#endregion
|
||
|
||
ws.PrintSetup.FitWidth = 1;
|
||
ws.PrintSetup.FitHeight = 0;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
|
||
ws.FitToPage = true;
|
||
|
||
//垂直水平居中
|
||
ws.VerticallyCenter = true;
|
||
ws.HorizontallyCenter = true;
|
||
//打印边距设置 厘米/3
|
||
ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
|
||
ws.SetMargin(MarginType.LeftMargin, (double)2.9 / 3);
|
||
ws.SetMargin(MarginType.TopMargin, (double)2.4 / 3);
|
||
ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
|
||
|
||
//页眉页脚间距
|
||
ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
ws.SetMargin(MarginType.FooterMargin, 0);
|
||
|
||
}
|
||
|
||
//36-TP-14-法兰螺栓扭矩记录表
|
||
private void template36(XSSFWorkbook hssfworkbook, XSSFSheet ws)
|
||
{
|
||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||
//插入图片部分
|
||
var img1 = Server.MapPath("~/res/images/bsf/1.png");
|
||
var img2 = Server.MapPath("~/res/images/bsf/2.png");
|
||
var img3 = Server.MapPath("~/res/images/bsf/3.png");
|
||
var img4 = Server.MapPath("~/res/images/bsf/4.png");
|
||
|
||
int rowIndex = 0;
|
||
var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
|
||
#region 头部
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 8, style, 0, 26, true);
|
||
for (int i = 0; i < 27; i++)
|
||
{
|
||
ws.SetColumnWidth(i, 4 * 256);
|
||
}
|
||
ws.GetRow(rowIndex).Height = 15 * 20;
|
||
ws.GetRow(rowIndex + 1).Height = 20 * 20;
|
||
ws.GetRow(rowIndex + 2).Height = 20 * 20;
|
||
ws.GetRow(rowIndex + 3).Height = 20 * 20;
|
||
ws.GetRow(rowIndex + 4).Height = 20 * 20;
|
||
ws.GetRow(rowIndex + 5).Height = 10 * 20;
|
||
ws.GetRow(rowIndex + 6).Height = 10 * 20;
|
||
ws.GetRow(rowIndex + 8).Height = 15 * 20;
|
||
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(0, 0, 0, 26), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(6, 6, 0, 26), ws);
|
||
RegionUtil.SetBorderTop(1, new CellRangeAddress(6, 6, 0, 26), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(7, 7, 0, 26), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(7, 7, 6, 6), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(7, 7, 13, 13), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(7, 7, 19, 19), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(0, 20, 26, 26), ws);
|
||
RegionUtil.SetBorderBottom(1, new CellRangeAddress(8, 8, 0, 26), ws);
|
||
|
||
InsertImage(hssfworkbook, ws, 1, 1, 2, 2, img1, 2, 1.8);
|
||
InsertImage(hssfworkbook, ws, 1, 3, 2, 4, img2, 2, 1.8, 0, 3);
|
||
InsertImage(hssfworkbook, ws, 1, 20, 2, 23, img3, 1.2, 2, 0, 10);
|
||
InsertImage(hssfworkbook, ws, 1, 24, 2, 26, img4, 1.2, 2, 0, 10);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 23, 24));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 25, 26));
|
||
ws.GetRow(rowIndex).GetCell(23).SetCellValue("Form No.");
|
||
ws.GetRow(rowIndex).GetCell(25).SetCellValue("TP-06");
|
||
|
||
var setStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 12, true, true, "Arial Unicode MS");
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 2, 5, 22));
|
||
ws.GetRow(rowIndex + 1).GetCell(5).CellStyle = setStyle;
|
||
ws.GetRow(rowIndex + 1).GetCell(5).SetCellValue("巴斯夫(广东)一体化项目\nBASF (GUANGDONG) INTEGRATED PROJECT");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 1, rowIndex + 5, 23, 26));
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 3, rowIndex + 4, 5, 22));
|
||
ws.GetRow(rowIndex + 3).GetCell(5).CellStyle = setStyle;
|
||
ws.GetRow(rowIndex + 3).GetCell(5).SetCellValue("螺栓扭矩报告\nBOLT TORQUE / TIGHTENING REPORT");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 0, 6));
|
||
ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("试压包号\nTEST PACKAGE NO.:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 7, 13));
|
||
ws.GetRow(rowIndex + 7).GetCell(7).SetCellValue(info?.testpackageNo);
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 14, 19));
|
||
ws.GetRow(rowIndex + 7).GetCell(14).SetCellValue("系统号\nSYSTEM NO.:");
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 7, rowIndex + 7, 20, 26));
|
||
ws.GetRow(rowIndex + 7).GetCell(20).SetCellValue(info?.SystemNo);
|
||
|
||
#endregion
|
||
|
||
#region 表格部分
|
||
|
||
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10, true, false, "Arial Unicode MS");
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 9, rowIndex + 33, style1, 0, 26, true);
|
||
for (int i = 9; i < 34; i++)
|
||
{
|
||
if (i == 10)
|
||
continue;
|
||
|
||
//列表头部两行合并
|
||
if (i == 9)
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 25 * 20;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 2, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 8, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 11, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 14, 16));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 17, 19));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 20, 22));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 23, 24));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i + 1, 25, 26));
|
||
}
|
||
else
|
||
{
|
||
ws.GetRow(rowIndex + i).Height = 18 * 20;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 0, 1));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 2, 7));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 8, 10));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 11, 13));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 14, 16));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 17, 19));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 20, 22));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 23, 24));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 25, 26));
|
||
}
|
||
}
|
||
ws.GetRow(rowIndex + 9).GetCell(0).SetCellValue("序号\nNo.");
|
||
ws.GetRow(rowIndex + 9).GetCell(2).SetCellValue("单线图号\nIsometric Line No.");
|
||
ws.GetRow(rowIndex + 9).GetCell(8).SetCellValue("法兰编号\nFlange No.");
|
||
ws.GetRow(rowIndex + 9).GetCell(11).SetCellValue("螺栓尺寸\nBolt Size");
|
||
ws.GetRow(rowIndex + 9).GetCell(14).SetCellValue("螺栓等级\nBolt Class");
|
||
ws.GetRow(rowIndex + 9).GetCell(17).SetCellValue("要求扭矩值\nRequired Torque");
|
||
ws.GetRow(rowIndex + 9).GetCell(20).SetCellValue("实际扭矩值\nActual Torque");
|
||
ws.GetRow(rowIndex + 9).GetCell(23).SetCellValue("接受\nACC");
|
||
ws.GetRow(rowIndex + 9).GetCell(25).SetCellValue("拒绝\nReject");
|
||
#endregion
|
||
|
||
#region 尾部
|
||
|
||
//文本左对齐置顶方式加换行
|
||
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, NPOI.SS.UserModel.HorizontalAlignment.Left, 10, false, false, "Arial Unicode MS");
|
||
style2.WrapText = true;
|
||
|
||
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 34, rowIndex + 45, style1, 0, 26, true);
|
||
ws.GetRow(rowIndex + 34).Height = 40 * 20;
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 34, rowIndex + 34, 0, 10));
|
||
ws.GetRow(rowIndex + 34).GetCell(0).SetCellValue("总计检查螺栓\nTotal Bolts Checked");
|
||
ws.GetRow(rowIndex + 34).GetCell(0).CellStyle = style2;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 34, rowIndex + 34, 11, 26));
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 35, rowIndex + 35, 0, 26));
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 36, rowIndex + 39, 0, 26));
|
||
ws.GetRow(rowIndex + 36).GetCell(0).SetCellValue("备注/意见:\nRemarks/Comments");
|
||
ws.GetRow(rowIndex + 36).GetCell(0).CellStyle = style2;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 40, rowIndex + 40, 0, 26));
|
||
ws.GetRow(rowIndex + 40).GetCell(0).SetCellValue("说明:按照BASF要求对螺栓进行扭矩工作。\nNotes: According to the BASF standard value to tighten the bolts.");
|
||
ws.GetRow(rowIndex + 40).GetCell(0).CellStyle = style2;
|
||
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 41, rowIndex + 41, 0, 26));
|
||
ws.GetRow(rowIndex + 41).GetCell(0).SetCellValue("批准:\nAccepted by:");
|
||
ws.GetRow(rowIndex + 41).GetCell(0).CellStyle = style2;
|
||
|
||
//循环合并单元格
|
||
for (int i = 42; i < 46; i++)
|
||
{
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 0, 3));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 4, 9));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 10, 15));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 16, 21));
|
||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 22, 26));
|
||
}
|
||
ws.GetRow(rowIndex + 42).GetCell(4).SetCellValue("CC7");
|
||
ws.GetRow(rowIndex + 42).GetCell(10).SetCellValue("JIANLI");
|
||
ws.GetRow(rowIndex + 42).GetCell(16).SetCellValue("Worley");
|
||
ws.GetRow(rowIndex + 42).GetCell(22).SetCellValue("BASF");
|
||
|
||
ws.GetRow(rowIndex + 43).GetCell(0).SetCellValue("姓名Name");
|
||
ws.GetRow(rowIndex + 43).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 44).GetCell(0).SetCellValue("签名Signature");
|
||
ws.GetRow(rowIndex + 44).GetCell(0).CellStyle = style2;
|
||
ws.GetRow(rowIndex + 45).GetCell(0).SetCellValue("日期Date");
|
||
ws.GetRow(rowIndex + 45).GetCell(0).CellStyle = style2;
|
||
|
||
//划线
|
||
RegionUtil.SetBorderLeft(1, new CellRangeAddress(rowIndex, rowIndex + 45, 0, 0), ws);
|
||
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex, rowIndex + 45, 26, 26), ws);
|
||
|
||
#endregion
|
||
|
||
ws.PrintSetup.FitWidth = 1;
|
||
ws.PrintSetup.FitHeight = 0;
|
||
ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
|
||
|
||
//垂直水平居中
|
||
ws.VerticallyCenter = true;
|
||
ws.HorizontallyCenter = true;
|
||
//打印边距设置 厘米/3
|
||
ws.SetMargin(MarginType.RightMargin, (double)2.4 / 3);
|
||
ws.SetMargin(MarginType.LeftMargin, (double)2.9 / 3);
|
||
ws.SetMargin(MarginType.TopMargin, (double)2.4 / 3);
|
||
ws.SetMargin(MarginType.BottomMargin, (double)2.4 / 3);
|
||
|
||
//页眉页脚间距
|
||
ws.SetMargin(MarginType.HeaderMargin, 0);
|
||
ws.SetMargin(MarginType.FooterMargin, 0);
|
||
|
||
ws.FitToPage = true;
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
private void CreateDataExcel(string[] templateFileIds)
|
||
{
|
||
var result = Funs.DB.Template_Files;
|
||
if (result == null)
|
||
return;
|
||
|
||
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
|
||
|
||
//导出文件
|
||
string filePath = rootPath + "\\";
|
||
if (!Directory.Exists(filePath))
|
||
{
|
||
Directory.CreateDirectory(filePath);
|
||
}
|
||
string fileName = "试压包报表-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
|
||
string ReportFileName = filePath + fileName;
|
||
|
||
//XSSFWorkbook hssfworkbook = new XSSFWorkbook();
|
||
|
||
string sourceFile = Server.MapPath("~/File/Excel/目录模版.xlsx");
|
||
// 打开源工作簿
|
||
XSSFWorkbook hssfworkbook;
|
||
using (FileStream file = new FileStream(sourceFile, FileMode.Open, FileAccess.Read))
|
||
{
|
||
hssfworkbook = (XSSFWorkbook)WorkbookFactory.Create(file);
|
||
}
|
||
|
||
//操作目录模版sheet是否存在,不存在就把对应的sheet删除掉(特殊处理)
|
||
int index = 0;
|
||
if (!templateFileIds.Contains("2BEFB0F4-A466-4C59-963F-9092BACF2E52"))
|
||
{
|
||
hssfworkbook.RemoveAt(0);
|
||
index++;
|
||
}
|
||
//'2-TP-02-试压包封面UG-FW-001
|
||
if (!templateFileIds.Contains("D4B4DD64-8361-4A75-AA3E-E484934B9B06"))
|
||
{
|
||
hssfworkbook.RemoveAt(1);
|
||
index++;
|
||
}
|
||
//3-TP-03-试压包目录UG-FW-001
|
||
if (!templateFileIds.Contains("6CD2710C-2AD6-4E7D-BED7-C8BEDAD300DE"))
|
||
{
|
||
hssfworkbook.RemoveAt(2 - index);
|
||
index++;
|
||
}
|
||
//4-TP-04-试压标识
|
||
if (!templateFileIds.Contains("87A66CAA-CA30-4A1E-8382-E8503059A0D0"))
|
||
{
|
||
hssfworkbook.RemoveAt(3 - index);
|
||
index++;
|
||
}
|
||
|
||
//对应正常sheet处理
|
||
foreach (var templateFileId in templateFileIds)
|
||
{
|
||
var oneTemp = result.FirstOrDefault(s => s.Id == templateFileId);
|
||
if (oneTemp == null)
|
||
continue;
|
||
switch (templateFileId)
|
||
{
|
||
|
||
//6-TP-05-P&ID清单UG-FW-001 模版
|
||
case "811EF650-7686-447F-BEE8-776D50041CD0":
|
||
XSSFSheet sheet6 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template6(hssfworkbook, sheet6);
|
||
break;
|
||
//8-TP-06-单线图清单UG-FW-001 模版
|
||
case "A1E35220-A321-482A-B745-5F6456ADFE43":
|
||
XSSFSheet sheet8 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template8(hssfworkbook, sheet8);
|
||
break;
|
||
//11-TP-07-盲板清单UG-FW-001
|
||
case "F20D530C-29BB-405F-AB0E-342496134375":
|
||
XSSFSheet sheet11 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template11(hssfworkbook, sheet11);
|
||
break;
|
||
//13-弹簧支吊架安装检验记录SHT 3503-J403
|
||
case "0F1A38BB-C98E-4C21-B9EC-8B03CCB22BF2":
|
||
XSSFSheet sheet13 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template13(hssfworkbook, sheet13);
|
||
break;
|
||
//14-滑动固定管托安装检验记录SHT 3503-J404
|
||
case "9C6CB4B3-446D-4C24-ADD8-DAC5F5DEF302":
|
||
XSSFSheet sheet14 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template14(hssfworkbook, sheet14);
|
||
break;
|
||
//15-管道补偿器安装检验记录SHT 3503-J405
|
||
case "854BF339-C7FA-4935-9CBD-C844904F62FB":
|
||
XSSFSheet sheet15 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template15(hssfworkbook, sheet15);
|
||
break;
|
||
//16-TP-08-静电接地清单UG-FW-001
|
||
case "FEF7F71B-E630-49CE-AB3D-6BFADA074DB6":
|
||
XSSFSheet sheet16 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template16(hssfworkbook, sheet16);
|
||
break;
|
||
//17-管道焊接接头热处理报告SHT 3503-J411
|
||
case "1E3D0EA0-CE64-44EA-964F-5B289F5A588B":
|
||
XSSFSheet sheet17 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template17(hssfworkbook, sheet17);
|
||
break;
|
||
//18-金属材料化学成分检验报告SHT 3503-J129
|
||
case "0DAD1096-EA35-446E-B628-2F20C449C641":
|
||
XSSFSheet sheet18 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template18(hssfworkbook, sheet18);
|
||
break;
|
||
//19-硬度检查报告SHT 3503-J130
|
||
case "4B60CC6A-4431-49DF-A754-8B2C595C8C27":
|
||
XSSFSheet sheet19 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template19(hssfworkbook, sheet19);
|
||
break;
|
||
//21-管道焊接工作记录SHT 3503-J415
|
||
case "1BDF3627-8632-48A3-B8CB-1D388D8A112A":
|
||
XSSFSheet sheet21 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template21(hssfworkbook, sheet21);
|
||
break;
|
||
//22-射线检测比例确认表SHT 3503-J412-2007
|
||
case "857BDF12-E4E1-4FF1-A8D5-FC96CF09E70D":
|
||
XSSFSheet sheet22 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template22(hssfworkbook, sheet22);
|
||
break;
|
||
//23-TP-09-超声&PAUT&TOFD检测比例确认表
|
||
case "0400055B-388A-40B0-BB7E-283B94864893":
|
||
XSSFSheet sheet23 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template23(hssfworkbook, sheet23);
|
||
break;
|
||
//24-TP-10-渗透&MT检测比例确认表
|
||
case "B33E6C98-F999-4DC6-B0A4-633AE85B349C":
|
||
XSSFSheet sheet24 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template24(hssfworkbook, sheet24);
|
||
break;
|
||
//25-1-管道无损检测结果汇总表SHT 3503-J412-2017
|
||
case "95125974-3DD4-4E16-B4F0-A9D9C9A1406D":
|
||
XSSFSheet sheet25_1 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template25_1(hssfworkbook, sheet25_1);
|
||
break;
|
||
//25-管道无损检测结果汇总表SHT 3503-J412-2017
|
||
case "4C45ABAB-89E9-4874-8F55-5050CDE98DFC":
|
||
XSSFSheet sheet25 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template25(hssfworkbook, sheet25);
|
||
break;
|
||
//26-管道无损检测数量统计表SHT 3503-J413-2017
|
||
case "6947FAA5-0475-4BEA-BE3A-C88BA503A0A5":
|
||
XSSFSheet sheet26 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template26(hssfworkbook, sheet26);
|
||
break;
|
||
//27-TP-11-尾项清单UG-FW-001
|
||
case "012F03CB-85D7-4F57-8A4D-38AC209886BF":
|
||
XSSFSheet sheet27 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template27(hssfworkbook, sheet27);
|
||
break;
|
||
//28-TP-12-试压用水(工具)检查清单UG-FW-001
|
||
case "DD6E665D-F784-41BA-88EF-E836AB1EC02F":
|
||
XSSFSheet sheet28 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template28(hssfworkbook, sheet28);
|
||
break;
|
||
//32-管道系统压力试验记录SHT 3503-J406-2
|
||
case "A5F52E0C-90D2-4228-96ED-5FC4125159C5":
|
||
XSSFSheet sheet32 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template32(hssfworkbook, sheet32);
|
||
break;
|
||
//33-管道吹扫清洗记录SHT 3503-J408 UG-FW-001
|
||
case "B1AE758D-3850-4397-A036-7FA54EFD0A69":
|
||
XSSFSheet sheet33 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template33(hssfworkbook, sheet33);
|
||
break;
|
||
//34-管道系统压力试验条件确认记录SHT 3503-J406-1
|
||
case "AFC08566-A8D0-4118-B240-AADA04305E1B":
|
||
XSSFSheet sheet34 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template34(hssfworkbook, sheet34);
|
||
break;
|
||
//35-TP-13-管道复位记录UG-FW-001
|
||
case "114E0846-93CB-4F12-A8BA-CE5B80C26A9C":
|
||
XSSFSheet sheet35_sheet1 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title + "-sheet1");
|
||
template35_sheet1(hssfworkbook, sheet35_sheet1);
|
||
XSSFSheet sheet35_sheet2 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title + "-sheet2");
|
||
template35_sheet2(hssfworkbook, sheet35_sheet2);
|
||
break;
|
||
//36-TP-14-法兰螺栓扭矩记录表
|
||
case "1C555FBB-DC81-4D2E-8EA7-8F6F0D4A4142":
|
||
XSSFSheet sheet36 = (XSSFSheet)hssfworkbook.CreateSheet(oneTemp.Title);
|
||
template36(hssfworkbook, sheet36);
|
||
break;
|
||
}
|
||
|
||
}
|
||
|
||
//生成第{N}个模版
|
||
|
||
using (FileStream filess = System.IO.File.OpenWrite(ReportFileName))
|
||
{
|
||
hssfworkbook.Write(filess);
|
||
}
|
||
try
|
||
{
|
||
FileInfo filet = new FileInfo(ReportFileName);
|
||
Response.Clear();
|
||
Response.ContentType = "application/x-zip-compressed";
|
||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||
Response.AddHeader("Content-Length", filet.Length.ToString());
|
||
Response.TransmitFile(ReportFileName, 0, filet.Length);
|
||
Response.Flush();
|
||
Response.Close();
|
||
System.IO.File.Delete(ReportFileName);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
BLL.ErrLogInfo.WriteLog(ex.Message);
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
#region 私有方法
|
||
|
||
public static TestPackageInfoViewModel GetTestPackageInfo(string ptpId)
|
||
{
|
||
var result = (from a in Funs.DB.PTP_TestPackage
|
||
join
|
||
b in Funs.DB.PTP_PipelineList on
|
||
a.PTP_ID equals b.PTP_ID
|
||
join c in Funs.DB.Base_Project on
|
||
a.ProjectId equals c.ProjectId
|
||
join d in Funs.DB.Project_WorkArea on
|
||
b.WorkAreaId equals d.WorkAreaId
|
||
where a.PTP_ID == ptpId
|
||
select new TestPackageInfoViewModel
|
||
{
|
||
enProjectName = c.EnProjectName,
|
||
projectName = c.ProjectName,
|
||
enWorkAreaName = d.EnWorkAreaName,
|
||
workAreaName = d.WorkAreaName,
|
||
workAreaCode = d.WorkAreaCode,
|
||
SystemNo = a.TestPackageName,
|
||
Auditer = a.Auditer,
|
||
testpackageNo = a.TestPackageNo,
|
||
TestPressure = a.TestPressure,
|
||
TestType = a.TestType
|
||
}).FirstOrDefault();
|
||
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询指定条数分页
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
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的框架
|
||
|
||
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;
|
||
}
|
||
/// <summary>
|
||
/// 获取某一列的所有值
|
||
/// </summary>
|
||
/// <typeparam name="T">列数据类型</typeparam>
|
||
/// <param name="dtSource">数据表</param>
|
||
/// <param name="filedName">列名</param>
|
||
/// <returns></returns>
|
||
public static List<T> GetColumnValues<T>(DataTable dtSource, string filedName)
|
||
{
|
||
return (from r in dtSource.AsEnumerable() select r.Field<T>(filedName)).ToList<T>();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 行和列
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private XSSFSheet ExcelCreateRow(XSSFSheet ws, XSSFWorkbook hssfworkbook, int sRows, int eRows, ICellStyle style, int cStart, int cEnd, bool istitle = false)
|
||
{
|
||
for (int i = sRows; i <= eRows; i++)
|
||
{
|
||
ws.CreateRow(i);
|
||
if (istitle)
|
||
{
|
||
ws.GetRow(i).HeightInPoints =
|
||
i == sRows ? 49.75f :
|
||
i == (sRows + 1) ? 13.75f :
|
||
38f;
|
||
}
|
||
else
|
||
{
|
||
ws.GetRow(i).HeightInPoints = 38f;
|
||
}
|
||
for (int j = cStart; j <= cEnd; j++)
|
||
{
|
||
ws.GetRow(i).CreateCell(j);
|
||
ws.GetRow(i).GetCell(j).CellStyle = style;
|
||
}
|
||
}
|
||
return ws;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 行和列
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private XSSFSheet ExcelCreateRowNew(XSSFSheet ws, XSSFWorkbook hssfworkbook, int sRows, int eRows, ICellStyle style, int cStart, int cEnd, float rowheigth = 13)
|
||
{
|
||
for (int i = sRows; i <= eRows; i++)
|
||
{
|
||
ws.CreateRow(i);
|
||
ws.GetRow(i).HeightInPoints = rowheigth;
|
||
for (int j = cStart; j <= cEnd; j++)
|
||
{
|
||
ws.GetRow(i).CreateCell(j);
|
||
ws.GetRow(i).GetCell(j).CellStyle = style;
|
||
}
|
||
}
|
||
return ws;
|
||
}
|
||
|
||
private ICellStyle SetStyle(XSSFWorkbook ws, BorderStyle top, BorderStyle bottom, BorderStyle left, BorderStyle right)
|
||
{
|
||
ICellStyle style = ws.CreateCellStyle();
|
||
style.BorderLeft = left;
|
||
style.BorderRight = right;
|
||
style.BorderTop = top;
|
||
style.BorderBottom = bottom;
|
||
|
||
return style;
|
||
}
|
||
|
||
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>
|
||
/// 22 实体
|
||
/// </summary>
|
||
private class template22Dto
|
||
{
|
||
public string PipelineCode { get; set; }
|
||
public string MaterialCode { get; set; }
|
||
public string Specification { get; set; }
|
||
public string jointCount { get; set; }
|
||
public string FjointCount { get; set; }
|
||
public string WelderCode { get; set; }
|
||
public string WelderNum { get; set; }
|
||
public string NdeNum { get; set; }
|
||
public string FNdeNum { get; set; }
|
||
public string NdeReportNo { get; set; }
|
||
}
|
||
|
||
#endregion
|
||
}
|
||
#endregion
|
||
|
||
} |