939 lines
53 KiB
C#
939 lines
53 KiB
C#
using BLL;
|
||
using NPOI.SS.UserModel;
|
||
using NPOI.SS.Util;
|
||
using NPOI.XSSF.UserModel;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Data.SqlClient;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
|
||
namespace FineUIPro.Web.ContinuousPrint
|
||
{
|
||
public partial class CommissionRepairPrint : PageBase
|
||
{
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
this.drpIsPrint.DataTextField = "Text";
|
||
this.drpIsPrint.DataValueField = "Value";
|
||
this.drpIsPrint.DataSource = BLL.DropListService.IsTrueOrFalseDrpList();
|
||
this.drpIsPrint.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpIsPrint);
|
||
|
||
BindGrid();
|
||
}
|
||
}
|
||
|
||
#region 绑定Grid1
|
||
/// <summary>
|
||
/// 绑定Grid1
|
||
/// </summary>
|
||
public void BindGrid()
|
||
{
|
||
var project = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
|
||
if (!string.IsNullOrEmpty(txtProjectCode.Text))
|
||
{
|
||
project = project.Where(e => e.ProjectCode.Contains(txtProjectCode.Text.Trim())).ToList();
|
||
}
|
||
Grid1.RecordCount = project.Count;
|
||
var table = this.GetPagedDataTable(Grid1, project);
|
||
Grid1.DataSource = table;
|
||
Grid1.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region 绑定Grid2
|
||
/// <summary>
|
||
/// 绑定Grid2
|
||
/// </summary>
|
||
public void BindGrid1(string ProjectId)
|
||
{
|
||
var str = string.Empty;
|
||
// 筛选关闭的批
|
||
if (this.drpIsPrint.SelectedValue != "null")
|
||
{
|
||
if (Convert.ToBoolean(drpIsPrint.SelectedValue))
|
||
{
|
||
str = " and isnull(a.CH_PrintDate,'')!=''";
|
||
}
|
||
else
|
||
{
|
||
str = " and isnull(a.CH_PrintDate,'')=''";
|
||
}
|
||
}
|
||
|
||
string strSql = @"select a.CH_RepairID,a.TrustItemID,a.Record_PrintDate,a.CH_RepairNo,a.CH_PrintDate,b.ProjectCode,b.ProjectName,b.ShortName,b.StartDate,b.EndDate from HJGL_CH_Repair as a inner join Base_Project as b on a.ProjectId=b.ProjectId where a.ProjectId= @ProjectId" + str;
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
listStr.Add(new SqlParameter("@ProjectId", ProjectId));
|
||
SqlParameter[] parameter = listStr.ToArray();
|
||
Grid2.DataSource = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||
Grid2.DataBind();
|
||
Grid2.SelectAllRows();
|
||
}
|
||
#endregion
|
||
|
||
#region 分页、排序
|
||
/// <summary>
|
||
/// 分页
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||
{
|
||
Grid1.PageIndex = e.NewPageIndex;
|
||
BindGrid();
|
||
}
|
||
|
||
/// <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();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 排序
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
||
{
|
||
Grid1.SortDirection = e.SortDirection;
|
||
Grid1.SortField = e.SortField;
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 选择加载
|
||
/// <summary>
|
||
/// 选择加载
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_RowClick(object sender, GridRowClickEventArgs e)
|
||
{
|
||
BindGrid1(this.Grid1.SelectedRowID);
|
||
}
|
||
#endregion
|
||
|
||
#region 私有方法
|
||
/// <summary>
|
||
/// 得到热处理类型
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
protected string ConvertProessTypes(object ProessTypes)
|
||
{
|
||
string proessTypes = string.Empty;
|
||
if (ProessTypes != null)
|
||
{
|
||
proessTypes = BLL.HJGL_PW_JointInfoService.ConvertProessTypes(ProessTypes.ToString());
|
||
}
|
||
|
||
return proessTypes;
|
||
}
|
||
#endregion
|
||
|
||
#region 关闭弹出窗口
|
||
/// <summary>
|
||
/// 关闭窗口
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Window1_Close(object sender, EventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 查询
|
||
/// <summary>
|
||
/// 查询
|
||
/// </summary>
|
||
protected void btnSubmit_Click(object sender, EventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 是否打印
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void drpIsPrint_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
BindGrid1(this.Grid1.SelectedRowID);
|
||
}
|
||
#endregion
|
||
|
||
#region 返修焊缝委托单打印
|
||
/// <summary>
|
||
/// 返修焊缝委托单打印
|
||
/// </summary>
|
||
protected void btnPrint_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid2.SelectedRowIndexArray.Length <= 0)
|
||
{
|
||
Alert.ShowInTop("最少选中一行!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
|
||
string initTemplatePath = "";
|
||
string rootPath = Server.MapPath("~/");
|
||
BLL.Common.FastReportService.ResetData();
|
||
|
||
if (Grid2.Rows.Count > 0)
|
||
{
|
||
for (int gi = 0; gi < Grid2.Rows.Count; gi++)
|
||
{
|
||
if (Grid2.SelectedRowIndexArray.Contains(gi))
|
||
{
|
||
System.Web.UI.WebControls.HiddenField hidCH_RepairID = Grid2.Rows[gi].FindControl("hidCH_RepairID") as System.Web.UI.WebControls.HiddenField;
|
||
System.Web.UI.WebControls.HiddenField hidProjectName = Grid2.Rows[gi].FindControl("hidProjectName") as System.Web.UI.WebControls.HiddenField;
|
||
Model.HJGL_CH_Repair repair = HJGL_RepairService.GetCH_RepairByID(hidCH_RepairID.Value);
|
||
if (repair != null)
|
||
{
|
||
repair.CH_PrintDate = DateTime.Now.Date;
|
||
repair.CH_Printer = this.CurrUser.UserName;
|
||
HJGL_RepairService.PrintCH_Repair(repair);
|
||
}
|
||
|
||
var listTitleStr = new List<SqlParameter>();
|
||
listTitleStr.Add(new SqlParameter("@CH_RepairID", hidCH_RepairID.Value));
|
||
SqlParameter[] titleparameter = listTitleStr.ToArray();
|
||
var tbTitle = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_Repair", titleparameter);
|
||
|
||
DataTable dt = new DataTable();
|
||
dt.TableName = "MainData";
|
||
dt.Columns.Add("ProjectName");
|
||
dt.Columns.Add("InstallastionName");
|
||
dt.Columns.Add("InstallatinCode");
|
||
dt.Columns.Add("TrustUnit");
|
||
dt.Columns.Add("TrustCode");
|
||
dt.Columns.Add("CheckUnit");
|
||
dt.Columns.Add("ItemName");
|
||
dt.Columns.Add("WME_Code");
|
||
dt.Columns.Add("IsHot");
|
||
dt.Columns.Add("JST_Name");
|
||
dt.Columns.Add("NDTR_Name");
|
||
dt.Columns.Add("NDT_Code");
|
||
dt.Columns.Add("AcceptGrade");
|
||
dt.Columns.Add("CH_NDTCriteria");
|
||
|
||
DataRow[] rows = tbTitle.DefaultView.ToTable().Select();
|
||
foreach (var row in rows)
|
||
{
|
||
var newRow = dt.NewRow();
|
||
newRow["ProjectName"] = row["ProjectName"].ToString();
|
||
newRow["InstallastionName"] = row["InstallationName"].ToString();
|
||
newRow["InstallatinCode"] = row["InstallationCode"].ToString();
|
||
newRow["TrustUnit"] = row["UnitName"].ToString();
|
||
newRow["TrustCode"] = row["CH_TrustCode"].ToString();
|
||
newRow["CheckUnit"] = row["CheckUnitName"].ToString();
|
||
newRow["ItemName"] = row["CH_ItemName"].ToString();
|
||
newRow["WME_Code"] = row["WME_Code"].ToString();
|
||
newRow["IsHot"] = "合格";
|
||
newRow["JST_Name"] = row["JST_Code"];
|
||
newRow["NDTR_Name"] = row["NDTR_Name"];
|
||
newRow["NDT_Code"] = row["NDT_Code"];
|
||
if (row["NDT_Code"].ToString() == "PT")
|
||
{
|
||
newRow["AcceptGrade"] = "Ⅰ";
|
||
}
|
||
else
|
||
{
|
||
int rate = Funs.GetNewIntOrZero(row["NDTR_Rate"].ToString());
|
||
if (row["NDT_Code"].ToString() == "RT" && rate < 20)
|
||
{
|
||
newRow["AcceptGrade"] = "Ⅲ";
|
||
}
|
||
else if (row["NDT_Code"].ToString() == "RT" && rate >= 20)
|
||
{
|
||
newRow["AcceptGrade"] = "Ⅱ";
|
||
}
|
||
else
|
||
{
|
||
newRow["AcceptGrade"] = row["AcceptGrade"].ToString();
|
||
}
|
||
}
|
||
if (row["NDT_Code"].ToString() == "RT")
|
||
{
|
||
newRow["CH_NDTCriteria"] = "NB/T 47013.2-2015";
|
||
}
|
||
else if (row["NDT_Code"].ToString() == "PT")
|
||
{
|
||
newRow["CH_NDTCriteria"] = "NB/T 47013.5-2015";
|
||
}
|
||
else if (row["NDT_Code"].ToString() == "UT")
|
||
{
|
||
newRow["CH_NDTCriteria"] = "NB/T 47013.3-2015";
|
||
}
|
||
else if (row["NDT_Code"].ToString() == "MT")
|
||
{
|
||
newRow["CH_NDTCriteria"] = "NB/T 47013.4-2015";
|
||
}
|
||
else if (row["NDT_Code"].ToString() == "PAUT")
|
||
{
|
||
newRow["CH_NDTCriteria"] = "NB/T 47013.15-2021";
|
||
}
|
||
else
|
||
{
|
||
newRow["CH_NDTCriteria"] = row["CH_NDTCriteria"].ToString();
|
||
}
|
||
dt.Rows.Add(newRow);
|
||
}
|
||
BLL.Common.FastReportService.AddFastreportTable(dt);
|
||
|
||
var listStr = new List<SqlParameter>();
|
||
listStr.Add(new SqlParameter("@CH_RepairID", hidCH_RepairID.Value));
|
||
SqlParameter[] parameter = listStr.ToArray();
|
||
var tb2 = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_RepairItem", parameter);
|
||
|
||
DataTable dt2 = new DataTable();
|
||
dt2.TableName = "Data";
|
||
dt2.Columns.Add("SortNum");
|
||
dt2.Columns.Add("IsoNo");
|
||
dt2.Columns.Add("ISO_Number");
|
||
dt2.Columns.Add("JointNo");
|
||
dt2.Columns.Add("JointDesc");
|
||
dt2.Columns.Add("Ste_Code");
|
||
dt2.Columns.Add("WelderCode");
|
||
dt2.Columns.Add("ISO_Name");
|
||
|
||
DataView dv = tb2.DefaultView;//获取表视图
|
||
dv.Sort = "ISO_IsoNo,JOT_JointNo ASC";//按照ID倒序排序
|
||
tb2 = dv.ToTable();//转为表
|
||
DataRow[] rows2 = tb2.DefaultView.ToTable().Select();
|
||
int i = 0;
|
||
foreach (var row in rows2)
|
||
{
|
||
var newRows = dt2.NewRow();
|
||
//if (i + 1 != rows2.Count())
|
||
//{
|
||
newRows["SortNum"] = i + 1;
|
||
//}
|
||
newRows["IsoNo"] = row["ISO_IsoNo"].ToString();
|
||
newRows["ISO_Number"] = row["ISO_IsoNo"].ToString();
|
||
newRows["JointNo"] = row["JOT_JointNo"].ToString();
|
||
newRows["JointDesc"] = row["JOT_JointDesc"].ToString();
|
||
newRows["Ste_Code"] = row["STE_Code"].ToString();
|
||
newRows["WelderCode"] = row["WED_Code"].ToString();
|
||
newRows["ISO_Name"] = row["ISC_IsoName"].ToString();
|
||
|
||
dt2.Rows.Add(newRows);
|
||
i++;
|
||
}
|
||
BLL.Common.FastReportService.AddFastreportTable(dt2);
|
||
|
||
string isoid = rows2[0]["ISO_ID"].ToString();
|
||
string jotyId = rows2[0]["JOTY_ID"].ToString();
|
||
int jointCount = BLL.HJGL_PW_JointInfoService.GetJointCountByIsoId(isoid, jotyId);
|
||
//传参
|
||
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||
keyValuePairs.Add("JointCount", jointCount.ToString());
|
||
keyValuePairs.Add("CheckCount", (rows.Count() - 1).ToString());
|
||
BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
|
||
|
||
|
||
}
|
||
}
|
||
initTemplatePath = "File\\Fastreport\\管道焊缝检测委托单.frx";
|
||
|
||
if (File.Exists(rootPath + initTemplatePath))
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../common/ReportPrint/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
||
|
||
}
|
||
}
|
||
|
||
#region 导出Excel,不用了
|
||
//string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
|
||
////导出文件
|
||
//string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
|
||
//if (!Directory.Exists(filePath))
|
||
//{
|
||
// Directory.CreateDirectory(filePath);
|
||
//}
|
||
//string ReportFileName = filePath + "out1.xlsx";
|
||
//if (Grid2.Rows.Count > 0)
|
||
//{
|
||
// int rowIndex = 0;
|
||
// XSSFWorkbook hssfworkbook = new XSSFWorkbook();
|
||
// XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("返修焊缝委托单");
|
||
|
||
// #region 列宽
|
||
// ws.SetColumnWidth(0, 5 * 256 + 164);//5
|
||
// ws.SetColumnWidth(1, 5 * 256);//4.36
|
||
// ws.SetColumnWidth(2, 12 * 256); //11.36
|
||
// ws.SetColumnWidth(3, 2 * 256); //1.36
|
||
// ws.SetColumnWidth(4, 12 * 256);//11.36
|
||
// ws.SetColumnWidth(5, 6 * 256);//5.36
|
||
// ws.SetColumnWidth(6, 5 * 256);//4.36
|
||
// ws.SetColumnWidth(7, 10 * 256);//9.36
|
||
// ws.SetColumnWidth(8, 5 * 256);//4.36
|
||
// ws.SetColumnWidth(9, 8 * 256);//7.36
|
||
// ws.SetColumnWidth(10, 10 * 256);//9.36
|
||
// ws.SetColumnWidth(11, 10 * 256);//9.36
|
||
// #endregion
|
||
|
||
// for (int gi = 0; gi < Grid2.Rows.Count; gi++)
|
||
// {
|
||
// if (Grid2.SelectedRowIndexArray.Contains(gi))
|
||
// {
|
||
// System.Web.UI.WebControls.HiddenField hidCH_RepairID = Grid2.Rows[gi].FindControl("hidCH_RepairID") as System.Web.UI.WebControls.HiddenField;
|
||
// System.Web.UI.WebControls.HiddenField hidProjectName = Grid2.Rows[gi].FindControl("hidProjectName") as System.Web.UI.WebControls.HiddenField;
|
||
// Model.HJGL_CH_Repair repair = HJGL_RepairService.GetCH_RepairByID(hidCH_RepairID.Value);
|
||
// if (repair != null)
|
||
// {
|
||
// repair.CH_PrintDate = DateTime.Now.Date;
|
||
// repair.CH_Printer = this.CurrUser.UserName;
|
||
// HJGL_RepairService.PrintCH_Repair(repair);
|
||
// }
|
||
// //列表
|
||
// var listStr = new List<SqlParameter>();
|
||
// listStr.Add(new SqlParameter("@CH_RepairID", hidCH_RepairID.Value));
|
||
// SqlParameter[] parameter = listStr.ToArray();
|
||
// var tb = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_RepairItem", parameter);
|
||
// //头部
|
||
// var listTitleStr = new List<SqlParameter>();
|
||
// listTitleStr.Add(new SqlParameter("@CH_RepairID", hidCH_RepairID.Value));
|
||
// SqlParameter[] titleparameter = listTitleStr.ToArray();
|
||
// var tbTitle = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_Repair", titleparameter);
|
||
// if (tb.Rows.Count > 0 && tbTitle.Rows.Count > 0)
|
||
// {
|
||
// var allPageNum = Math.Ceiling((float)tb.Rows.Count / 15);
|
||
// var titIsXu = 26;
|
||
// for (int i = 1; i <= allPageNum; i++)
|
||
// {
|
||
// //公共样式
|
||
// ICellStyle style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true);
|
||
// //有边框文字居左
|
||
// ICellStyle leftstyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true);
|
||
// //有边框文字居中
|
||
// ICellStyle centerstyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 12, true);
|
||
// //底部双底虚线
|
||
// ICellStyle doubleLinestyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Double, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true);
|
||
// //无边框文字靠左
|
||
// ICellStyle leftNoneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10, true);
|
||
// //无边框文字靠右
|
||
// ICellStyle rightNoneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10, true);
|
||
// //头部样式
|
||
// ICellStyle titleStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 11, true, true, "黑体");
|
||
// ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, int.Parse((rowIndex + titIsXu).ToString()), style, 0, 11);//表格列数
|
||
// #region 头部
|
||
// //行0
|
||
// CellRangeAddress region = new CellRangeAddress(rowIndex, rowIndex + 1, 0, 2);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex).GetCell(0).SetCellValue("浙江石油化工有限公司");
|
||
// ws.GetRow(rowIndex).GetCell(0).CellStyle = centerstyle;
|
||
// ws.GetRow(rowIndex).GetCell(1).CellStyle = centerstyle;
|
||
// ws.GetRow(rowIndex).GetCell(2).CellStyle = centerstyle;
|
||
|
||
// region = new CellRangeAddress(rowIndex, rowIndex + 1, 3, 7);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex).GetCell(3).SetCellValue("管道焊缝返修检测委托单");
|
||
// ws.GetRow(rowIndex).GetCell(3).CellStyle = titleStyle;
|
||
// ws.GetRow(rowIndex).GetCell(4).CellStyle = titleStyle;
|
||
// ws.GetRow(rowIndex).GetCell(5).CellStyle = titleStyle;
|
||
// ws.GetRow(rowIndex).GetCell(6).CellStyle = titleStyle;
|
||
// ws.GetRow(rowIndex).GetCell(7).CellStyle = titleStyle;
|
||
|
||
// region = new CellRangeAddress(rowIndex, rowIndex, 8, 11);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex).GetCell(8).SetCellValue("工程名称:" + tbTitle.Rows[0]["ProjectName"].ToString());
|
||
// ws.GetRow(rowIndex).GetCell(8).CellStyle = leftstyle;
|
||
// ws.GetRow(rowIndex).GetCell(9).CellStyle = leftstyle;
|
||
// ws.GetRow(rowIndex).GetCell(10).CellStyle = leftstyle;
|
||
// ws.GetRow(rowIndex).GetCell(11).CellStyle = leftstyle;
|
||
|
||
// //行1
|
||
// region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 8, 11);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 1).GetCell(8).SetCellValue("单位工程名称:管道安装");
|
||
// ws.GetRow(rowIndex + 1).GetCell(8).CellStyle = leftstyle;
|
||
|
||
// //行2
|
||
// region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 0, 1);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("装置名称");
|
||
|
||
// region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 2, 5);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue(tbTitle.Rows[0]["InstallationName"].ToString());
|
||
|
||
// region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 6, 7);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("装置主项号");
|
||
|
||
// region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 11);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue(tbTitle.Rows[0]["InstallationCode"].ToString());
|
||
|
||
// //行3
|
||
// region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 0, 1);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("委托单位");
|
||
|
||
// region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 2, 5);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 3).GetCell(2).SetCellValue(tbTitle.Rows[0]["UnitName"].ToString());
|
||
|
||
// region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 6, 7);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("委托单编号");
|
||
|
||
// region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 8, 11);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue(tbTitle.Rows[0]["CH_TrustCode"].ToString());
|
||
|
||
// //行4
|
||
// region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("承包商");
|
||
|
||
// ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue("鼎盛石化工程有限公司");
|
||
|
||
// region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 3, 4);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 4).GetCell(3).SetCellValue("检测单位");
|
||
|
||
// region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 5, 6);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 4).GetCell(5).SetCellValue(tbTitle.Rows[0]["CheckUnitName"].ToString());
|
||
|
||
// ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("检件名称");
|
||
|
||
// region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 8, 9);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 4).GetCell(8).SetCellValue("工业管道");
|
||
|
||
// ws.GetRow(rowIndex + 4).GetCell(10).SetCellValue("外观检查");
|
||
|
||
// ws.GetRow(rowIndex + 4).GetCell(11).SetCellValue("合格");
|
||
|
||
// //行5
|
||
// region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 0, 1);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("焊接方法");
|
||
|
||
// ws.GetRow(rowIndex + 5).GetCell(2).SetCellValue(tbTitle.Rows[0]["WME_Code"].ToString());
|
||
|
||
// region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 3, 4);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 5).GetCell(3).SetCellValue("热处理状态");
|
||
|
||
// region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 5, 6);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 5).GetCell(5).SetCellValue(tbTitle.Rows[0]["IsHot"].ToString());
|
||
|
||
// ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("坡口形式");
|
||
|
||
// region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 8, 9);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue(tbTitle.Rows[0]["JST_Code"].ToString());
|
||
|
||
// ws.GetRow(rowIndex + 5).GetCell(10).SetCellValue("检测比例");
|
||
|
||
// ws.GetRow(rowIndex + 5).GetCell(11).SetCellValue(tbTitle.Rows[0]["NDTR_Name"].ToString());
|
||
|
||
// //行6
|
||
// region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 0, 1);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("检测方法");
|
||
|
||
// ws.GetRow(rowIndex + 6).GetCell(2).SetCellValue(tbTitle.Rows[0]["NDT_Code"].ToString());
|
||
|
||
// region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 3, 4);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 6).GetCell(3).SetCellValue("检测时机");
|
||
|
||
// region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 5, 6);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 6).GetCell(5).SetCellValue("焊后");
|
||
|
||
// ws.GetRow(rowIndex + 6).GetCell(7).SetCellValue("技术等级");
|
||
|
||
// region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 8, 9);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 6).GetCell(8).SetCellValue("AB级");
|
||
|
||
// ws.GetRow(rowIndex + 6).GetCell(10).SetCellValue("合格级别");
|
||
|
||
// ws.GetRow(rowIndex + 6).GetCell(11).SetCellValue(tbTitle.Rows[0]["AcceptGrade"].ToString());
|
||
|
||
// //行7
|
||
// region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 0, 1);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("检测标准");
|
||
|
||
// ws.GetRow(rowIndex + 7).GetCell(2).SetCellValue(tbTitle.Rows[0]["CH_NDTCriteria"].ToString());
|
||
|
||
// region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 3, 4);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 7).GetCell(3).SetCellValue("检测部位");
|
||
|
||
// region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 5, 6);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(rowIndex + 7).GetCell(5).SetCellValue("焊缝");
|
||
|
||
// ws.GetRow(rowIndex + 7).GetCell(7).SetCellValue("焊口总数");
|
||
|
||
// region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 8, 9);
|
||
// ws.AddMergedRegion(region);
|
||
// string isoid = tb.Rows[0]["ISO_ID"].ToString();
|
||
// string jotyId = tb.Rows[0]["JOTY_ID"].ToString();
|
||
// int jointCount = BLL.HJGL_PW_JointInfoService.GetJointCountByIsoId(isoid, jotyId);
|
||
// ws.GetRow(rowIndex + 7).GetCell(8).SetCellValue(jointCount.ToString());
|
||
|
||
// ws.GetRow(rowIndex + 7).GetCell(10).SetCellValue("检测数量");
|
||
// ws.GetRow(rowIndex + 7).GetCell(11).SetCellValue((tb.Rows.Count-1).ToString());
|
||
|
||
// #endregion
|
||
|
||
// #region 表格
|
||
// var dataTit = rowIndex + 8;
|
||
// //合并单元格
|
||
// for (int hb = dataTit; hb <= rowIndex + titIsXu; hb++)
|
||
// {
|
||
// region = new CellRangeAddress(hb, hb, 1, 3);
|
||
// ws.AddMergedRegion(region);
|
||
// region = new CellRangeAddress(hb, hb, 5, 6);
|
||
// ws.AddMergedRegion(region);
|
||
// region = new CellRangeAddress(hb, hb, 8, 9);
|
||
// ws.AddMergedRegion(region);
|
||
// }
|
||
|
||
// //每页数据开始和结束条数
|
||
// var dStart = i == 1 ? 0 : (i - 1) * 16;
|
||
// var dEnd = i * 16;
|
||
|
||
// //获取当前页数据
|
||
// var pageTb = GetPageToTable(tb, dStart, dEnd);
|
||
|
||
|
||
// //列头
|
||
// ws.GetRow(dataTit).GetCell(0).SetCellValue("序号");
|
||
// ws.GetRow(dataTit).GetCell(1).SetCellValue("管线编号");
|
||
// ws.GetRow(dataTit).GetCell(4).SetCellValue("单线号");
|
||
// ws.GetRow(dataTit).GetCell(5).SetCellValue("焊口编号");
|
||
// ws.GetRow(dataTit).GetCell(7).SetCellValue("焊口规格");
|
||
// ws.GetRow(dataTit).GetCell(8).SetCellValue("材质");
|
||
// ws.GetRow(dataTit).GetCell(10).SetCellValue("焊工号");
|
||
// ws.GetRow(dataTit).GetCell(11).SetCellValue("管道等级");
|
||
|
||
// //数据
|
||
// for (int j = 0; j < pageTb.Rows.Count; j++)
|
||
// {
|
||
// int dataIndex = dataTit + j + 1;
|
||
// ws.GetRow(dataIndex).GetCell(0).SetCellValue(pageTb.Rows[j]["Number"].ToString());
|
||
// ws.GetRow(dataIndex).GetCell(1).SetCellValue(pageTb.Rows[j]["ISO_IsoNo"].ToString());
|
||
// ws.GetRow(dataIndex).GetCell(4).SetCellValue(pageTb.Rows[j]["ISO_IsoNo"].ToString());
|
||
// ws.GetRow(dataIndex).GetCell(5).SetCellValue(pageTb.Rows[j]["JOT_JointNo"].ToString());
|
||
// ws.GetRow(dataIndex).GetCell(7).SetCellValue(pageTb.Rows[j]["JOT_JointDesc"].ToString());
|
||
// ws.GetRow(dataIndex).GetCell(8).SetCellValue(pageTb.Rows[j]["STE_Code"].ToString());
|
||
// ws.GetRow(dataIndex).GetCell(10).SetCellValue(pageTb.Rows[j]["WED_Code"].ToString());
|
||
// ws.GetRow(dataIndex).GetCell(11).SetCellValue(pageTb.Rows[j]["ISC_IsoName"].ToString());
|
||
// }
|
||
|
||
// #endregion
|
||
|
||
// #region 尾部
|
||
// //尾部样式无线条
|
||
// ICellStyle noneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10);
|
||
// var tEnd = int.Parse((rowIndex + titIsXu + 1).ToString());
|
||
// ////创建尾部
|
||
// ws.CreateRow(tEnd);
|
||
// ws.CreateRow(tEnd).HeightInPoints = 21f;
|
||
// ws.CreateRow(tEnd + 1);
|
||
// ws.CreateRow(tEnd + 1).HeightInPoints = 21f;
|
||
// ws.CreateRow(tEnd + 2);
|
||
// ws.CreateRow(tEnd + 2).HeightInPoints = 21f;
|
||
// ws.CreateRow(tEnd + 3);
|
||
// ws.CreateRow(tEnd + 3).HeightInPoints = 21f;
|
||
// ws.CreateRow(tEnd + 4);
|
||
// ws.CreateRow(tEnd + 4).HeightInPoints = 21f;
|
||
// ws.CreateRow(tEnd + 5);
|
||
// ws.CreateRow(tEnd + 5).HeightInPoints = 21f;
|
||
// ws.CreateRow(tEnd + 6);
|
||
// ws.CreateRow(tEnd + 6).HeightInPoints = 21f;
|
||
|
||
// for (int eIndex = 0; eIndex <= 12; eIndex++)
|
||
// {
|
||
// ws.GetRow(tEnd).CreateCell(eIndex);
|
||
// ws.GetRow(tEnd).GetCell(eIndex).CellStyle = noneStyle;
|
||
// //行1
|
||
// ws.GetRow(tEnd + 1).CreateCell(eIndex);
|
||
// ws.GetRow(tEnd + 1).GetCell(eIndex).CellStyle = noneStyle;
|
||
// //行2
|
||
// ws.GetRow(tEnd + 2).CreateCell(eIndex);
|
||
// ws.GetRow(tEnd + 2).GetCell(eIndex).CellStyle = noneStyle;
|
||
// //行3
|
||
// ws.GetRow(tEnd + 3).CreateCell(eIndex);
|
||
// ws.GetRow(tEnd + 3).GetCell(eIndex).CellStyle = noneStyle;
|
||
// //行4
|
||
// ws.GetRow(tEnd + 4).CreateCell(eIndex);
|
||
// ws.GetRow(tEnd + 4).GetCell(eIndex).CellStyle = noneStyle;
|
||
// //行5
|
||
// ws.GetRow(tEnd + 5).CreateCell(eIndex);
|
||
// ws.GetRow(tEnd + 5).GetCell(eIndex).CellStyle = noneStyle;
|
||
// //行6
|
||
// ws.GetRow(tEnd + 6).CreateCell(eIndex);
|
||
// ws.GetRow(tEnd + 6).GetCell(eIndex).CellStyle = noneStyle;
|
||
// }
|
||
|
||
// //尾部样式左侧线条文字靠左
|
||
// ICellStyle leftStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
// //尾部样式右侧线条文字靠左
|
||
// ICellStyle rightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
// //尾部样式上、下、左侧线文字居中
|
||
// ICellStyle topBottomLeftStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10);
|
||
// //上、下线文字靠左
|
||
// ICellStyle topBottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
// //上、下、右侧线文字靠左
|
||
// ICellStyle topBottomRightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
// //左、下线文字居左
|
||
// ICellStyle leftBottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
// //下线文字靠左
|
||
// ICellStyle bottomStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
// //下、右侧线文字靠左
|
||
// ICellStyle bottomRightStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.None, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10);
|
||
|
||
// //尾部行1
|
||
// region = new CellRangeAddress(tEnd, tEnd, 0, 11);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd).GetCell(0).SetCellValue("注:");
|
||
// ws.GetRow(tEnd).GetCell(0).CellStyle = leftStyle;
|
||
// ws.GetRow(tEnd).GetCell(11).CellStyle = rightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 1, tEnd + 1, 0, 11);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 1).GetCell(0).SetCellValue("1、附图 张;");
|
||
// ws.GetRow(tEnd + 1).GetCell(0).CellStyle = leftStyle;
|
||
// ws.GetRow(tEnd + 1).GetCell(11).CellStyle = rightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 2, tEnd + 2, 0, 11);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 2).GetCell(0).SetCellValue("2、需要说明的其他问题:");
|
||
// ws.GetRow(tEnd + 2).GetCell(0).CellStyle = leftStyle;
|
||
// ws.GetRow(tEnd + 2).GetCell(11).CellStyle = rightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 3, tEnd + 3, 0, 2);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 3).GetCell(0).SetCellValue("承包商");
|
||
// ws.GetRow(tEnd + 3).GetCell(0).CellStyle = topBottomLeftStyle;
|
||
// ws.GetRow(tEnd + 3).GetCell(1).CellStyle = topBottomStyle;
|
||
// ws.GetRow(tEnd + 3).GetCell(2).CellStyle = topBottomRightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 3, tEnd + 3, 3, 5);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 3).GetCell(3).SetCellValue("监理单位");
|
||
// ws.GetRow(tEnd + 3).GetCell(3).CellStyle = topBottomLeftStyle;
|
||
// ws.GetRow(tEnd + 3).GetCell(4).CellStyle = topBottomStyle;
|
||
// ws.GetRow(tEnd + 3).GetCell(5).CellStyle = topBottomRightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 3, tEnd + 3, 6, 8);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 3).GetCell(6).SetCellValue("项目部");
|
||
// ws.GetRow(tEnd + 3).GetCell(6).CellStyle = topBottomLeftStyle;
|
||
// ws.GetRow(tEnd + 3).GetCell(7).CellStyle = topBottomStyle;
|
||
// ws.GetRow(tEnd + 3).GetCell(8).CellStyle = topBottomRightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 3, tEnd + 3, 9, 11);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 3).GetCell(9).SetCellValue("检测单位");
|
||
// ws.GetRow(tEnd + 3).GetCell(9).CellStyle = topBottomLeftStyle;
|
||
// ws.GetRow(tEnd + 3).GetCell(10).CellStyle = topBottomStyle;
|
||
// ws.GetRow(tEnd + 3).GetCell(11).CellStyle = topBottomRightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 4, tEnd + 4, 0, 2);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 4).GetCell(0).SetCellValue("");
|
||
// ws.GetRow(tEnd + 4).GetCell(0).CellStyle = leftStyle;
|
||
// ws.GetRow(tEnd + 4).GetCell(2).CellStyle = rightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 4, tEnd + 4, 3, 5);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 4).GetCell(3).SetCellValue("");
|
||
// ws.GetRow(tEnd + 4).GetCell(3).CellStyle = leftStyle;
|
||
// ws.GetRow(tEnd + 4).GetCell(5).CellStyle = rightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 4, tEnd + 4, 6, 8);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 4).GetCell(6).SetCellValue("");
|
||
// ws.GetRow(tEnd + 4).GetCell(6).CellStyle = leftStyle;
|
||
// ws.GetRow(tEnd + 4).GetCell(8).CellStyle = rightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 4, tEnd + 4, 9, 11);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 4).GetCell(9).SetCellValue("");
|
||
// ws.GetRow(tEnd + 4).GetCell(9).CellStyle = leftStyle;
|
||
// ws.GetRow(tEnd + 4).GetCell(11).CellStyle = rightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 5, tEnd + 5, 0, 2);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 5).GetCell(0).SetCellValue("签字:");
|
||
// ws.GetRow(tEnd + 5).GetCell(0).CellStyle = leftStyle;
|
||
// ws.GetRow(tEnd + 5).GetCell(2).CellStyle = rightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 5, tEnd + 5, 3, 5);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 5).GetCell(3).SetCellValue("签字:");
|
||
// ws.GetRow(tEnd + 5).GetCell(3).CellStyle = leftStyle;
|
||
// ws.GetRow(tEnd + 5).GetCell(5).CellStyle = rightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 5, tEnd + 5, 6, 8);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 5).GetCell(6).SetCellValue("签字:");
|
||
// ws.GetRow(tEnd + 5).GetCell(6).CellStyle = leftStyle;
|
||
// ws.GetRow(tEnd + 5).GetCell(8).CellStyle = rightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 5, tEnd + 5, 9, 11);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 5).GetCell(9).SetCellValue("签字:");
|
||
// ws.GetRow(tEnd + 5).GetCell(9).CellStyle = leftStyle;
|
||
// ws.GetRow(tEnd + 5).GetCell(11).CellStyle = rightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 6, tEnd + 6, 0, 2);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 6).GetCell(0).SetCellValue("日期:");
|
||
// ws.GetRow(tEnd + 6).GetCell(0).CellStyle = leftBottomStyle;
|
||
// ws.GetRow(tEnd + 6).GetCell(1).CellStyle = bottomStyle;
|
||
// ws.GetRow(tEnd + 6).GetCell(2).CellStyle = bottomRightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 6, tEnd + 6, 3, 5);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 6).GetCell(3).SetCellValue("日期:");
|
||
// ws.GetRow(tEnd + 6).GetCell(3).CellStyle = leftBottomStyle;
|
||
// ws.GetRow(tEnd + 6).GetCell(4).CellStyle = bottomStyle;
|
||
// ws.GetRow(tEnd + 6).GetCell(5).CellStyle = bottomRightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 6, tEnd + 6, 6, 8);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 6).GetCell(6).SetCellValue("日期:");
|
||
// ws.GetRow(tEnd + 6).GetCell(6).CellStyle = leftBottomStyle;
|
||
// ws.GetRow(tEnd + 6).GetCell(7).CellStyle = bottomStyle;
|
||
// ws.GetRow(tEnd + 6).GetCell(8).CellStyle = bottomRightStyle;
|
||
|
||
// region = new CellRangeAddress(tEnd + 6, tEnd + 6, 9, 11);
|
||
// ws.AddMergedRegion(region);
|
||
// ws.GetRow(tEnd + 6).GetCell(9).SetCellValue("日期:");
|
||
// ws.GetRow(tEnd + 6).GetCell(9).CellStyle = leftBottomStyle;
|
||
// ws.GetRow(tEnd + 6).GetCell(10).CellStyle = bottomStyle;
|
||
// ws.GetRow(tEnd + 6).GetCell(11).CellStyle = bottomRightStyle;
|
||
|
||
// #endregion
|
||
|
||
// rowIndex += int.Parse((titIsXu + 8).ToString());
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// ws.SetMargin(MarginType.LeftMargin, 0.7);
|
||
// ws.SetMargin(MarginType.RightMargin, 0.5);
|
||
|
||
// ws.PrintSetup.Landscape = false;
|
||
// ws.PrintSetup.PaperSize = 9;
|
||
|
||
// ws.ForceFormulaRecalculation = true;
|
||
// using (FileStream filess = File.OpenWrite(ReportFileName))
|
||
// {
|
||
// hssfworkbook.Write(filess);
|
||
// }
|
||
// FileInfo filet = new FileInfo(ReportFileName);
|
||
// Response.Clear();
|
||
// Response.Charset = "GB2312";
|
||
// Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||
// // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
|
||
// Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode("返修焊缝委托单.xlsx"));
|
||
// // 添加头信息,指定文件大小,让浏览器能够显示下载进度
|
||
// Response.AddHeader("Content-Length", filet.Length.ToString());
|
||
// // 指定返回的是一个不能被客户端读取的流,必须被下载
|
||
// Response.ContentType = "application/ms-excel";
|
||
// // 把文件流发送到客户端
|
||
// Response.WriteFile(filet.FullName);
|
||
// // 停止页面的执行
|
||
// Response.End();
|
||
//}
|
||
#endregion
|
||
}
|
||
#endregion
|
||
|
||
#region 私有方法
|
||
|
||
/// <summary>
|
||
/// 行和列
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private XSSFSheet ExcelCreateRow(XSSFSheet ws, XSSFWorkbook hssfworkbook, int sRows, int eRows, ICellStyle style, int cStart, int cEnd, int ptype = 1)
|
||
{
|
||
var noneStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 7, true);
|
||
for (int i = sRows; i <= eRows; i++)
|
||
{
|
||
ws.CreateRow(i);
|
||
ws.GetRow(i).HeightInPoints =
|
||
i == sRows ? 19.5f :
|
||
i == (sRows + 1) ? 20.3f :
|
||
i == (sRows + 2) ? 31.5f :
|
||
i == (sRows + 3) ? 21.8f :
|
||
i == (sRows + 5) ? 21f :
|
||
i == (sRows + 6) ? 21.8f :
|
||
i == (sRows + 7) ? 21.8f :
|
||
i == (sRows + 8) ? 21.8f :
|
||
i == (sRows + 9) ? 21.8f :
|
||
i == (sRows + 10) ? 25.5f :
|
||
22.5f;
|
||
for (int j = cStart; j <= cEnd; j++)
|
||
{
|
||
ws.GetRow(i).CreateCell(j);
|
||
ws.GetRow(i).GetCell(j).CellStyle = i == sRows ? noneStyle : style;
|
||
}
|
||
}
|
||
return ws;
|
||
}
|
||
|
||
/// <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;
|
||
}
|
||
|
||
#endregion
|
||
|
||
}
|
||
} |