1528 lines
79 KiB
C#
1528 lines
79 KiB
C#
using BLL;
|
|
using NPOI.HSSF.Util;
|
|
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.Threading;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.Report
|
|
{
|
|
public partial class DocumentationStatusMC :PageBase
|
|
{
|
|
public static int percent { get; set; }
|
|
public static string url { get; set; }
|
|
|
|
[System.Web.Services.WebMethod]
|
|
public static int getPercent()
|
|
{
|
|
return percent;
|
|
}
|
|
|
|
[System.Web.Services.WebMethod]
|
|
public static string getUrl()
|
|
{
|
|
return url;
|
|
}
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
// 表头过滤
|
|
FilterDataRowItem = FilterDataRowItemImplement;
|
|
if (!IsPostBack)
|
|
{
|
|
GetButtonPower();//权限设置
|
|
|
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|
|
|
BLL.ConstService.InitConstValueDropDownList(this.drpJobStatus, BLL.Const.ProjectPlanner_JobStatus, true);
|
|
|
|
// 绑定表格
|
|
BindGrid();
|
|
}
|
|
else if (GetRequestEventArgument() == "FilterChange")
|
|
{
|
|
BindGrid();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
|
|
string strSql = @"SELECT * FROM View_Report_DocumentationStatusMC WHERE 1=1 ";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
if (this.drpJobStatus.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpJobStatus.SelectedValue))
|
|
{
|
|
string status = String.Join(",", drpJobStatus.SelectedItemArray.Select(e => e.Text));
|
|
//strSql += " AND ProjectControl_JobStatus=@jobStatus ";
|
|
strSql += " AND CHARINDEX(ProjectControl_JobStatus,@jobStatus)>0";
|
|
listStr.Add(new SqlParameter("@jobStatus", status));
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
|
|
{
|
|
strSql += " AND ProjectControl_JobNo LIKE @JobNO ";
|
|
listStr.Add(new SqlParameter("@JobNO", this.txtJobNo.Text.Trim() + "%"));
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtJobReveiveDate.Text.Trim()))
|
|
{
|
|
strSql += " AND PM_MA_JobReveive>=@JobReveiveDate ";
|
|
listStr.Add(new SqlParameter("@JobReveiveDate", Convert.ToDateTime(this.txtJobReveiveDate.Text.Trim())));
|
|
}
|
|
strSql += " ORDER BY ProjectControl_JobNo DESC,Phase";
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
#endregion
|
|
|
|
#region 过滤表头
|
|
/// <summary>
|
|
/// 过滤表头
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_FilterChange(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据表头信息过滤列表数据
|
|
/// </summary>
|
|
/// <param name="sourceObj"></param>
|
|
/// <param name="fillteredOperator"></param>
|
|
/// <param name="fillteredObj"></param>
|
|
/// <param name="column"></param>
|
|
/// <returns></returns>
|
|
private bool FilterDataRowItemImplement(object sourceObj, string fillteredOperator, object fillteredObj, string column)
|
|
{
|
|
bool valid = false;
|
|
if (column == "ProjectControl_JobNo")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "ProjectControl_ProjectManager")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "ProjectControl_LeadByName")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "ProjectControl_BUCode")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "ProjectControl_MS_MC")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "ProjectControl_JobStatus")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "ProjectControl_JobType")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "ProjectControl_TDCManager")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "Phase")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "Process")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "Plumbling")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "Equipment")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "Piping")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "SHE")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "Electrical")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "Communication")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "Instrument")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "Civil")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "Architectral")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
|
|
if (column == "HVAC")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "MasterpLanning")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
if (column == "ALLS")
|
|
{
|
|
string sourceValue = sourceObj.ToString();
|
|
string fillteredValue = fillteredObj.ToString();
|
|
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
|
{
|
|
valid = true;
|
|
}
|
|
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
|
{
|
|
valid = true;
|
|
}
|
|
}
|
|
return valid;
|
|
}
|
|
#endregion
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 下拉框选择事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void DropDownList_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#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 btnExport_Click(object sender, EventArgs e)
|
|
{
|
|
percent = 0;
|
|
url = "";
|
|
|
|
var docReport = from x in Funs.DB.View_Report_DocumentationStatusMC select x;
|
|
if (this.drpJobStatus.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpJobStatus.SelectedValue))
|
|
{
|
|
docReport = from x in docReport where drpJobStatus.SelectedValueArray.Contains(x.ProjectControl_JobStatus) select x;
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
|
|
{
|
|
docReport = from x in docReport where x.ProjectControl_JobNo.StartsWith(this.txtJobNo.Text.Trim()) select x;
|
|
//docReport = from x in docReport where x.ProjectControl_JobNo.Contains(this.txtJobNo.Text.Trim()) select x;
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtJobReveiveDate.Text.Trim()))
|
|
{
|
|
docReport = from x in docReport where x.PM_MA_JobReveive >= Convert.ToDateTime(this.txtJobReveiveDate.Text.Trim()) select x;
|
|
}
|
|
var list = (docReport.OrderByDescending(x => x.ProjectControl_JobNo).ThenBy(x => x.Phase)).ToList();
|
|
|
|
Thread t = new Thread(new ThreadStart(() => { Export(list); }));
|
|
t.Start();
|
|
PageContext.RegisterStartupScript("showProcessBar()");
|
|
}
|
|
|
|
private void Export(List<Model.View_Report_DocumentationStatusMC> list)
|
|
{
|
|
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
|
|
//模板文件
|
|
string TempletFileName = rootPath + "Documentation_Status_MC.xlsx";
|
|
//导出文件
|
|
string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
|
|
if (!Directory.Exists(filePath))
|
|
{
|
|
Directory.CreateDirectory(filePath);
|
|
}
|
|
string ReportFileName = filePath + "P22_Document_Status_MC_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx";
|
|
|
|
FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
|
|
XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
|
|
|
|
#region Documentation_Status_Takeover
|
|
XSSFSheet reportModel = (XSSFSheet)hssfworkbook.GetSheet("Documentation_Status_Report");
|
|
|
|
XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
|
|
cs_content_Font.FontName = "sans-serif";//字体
|
|
cs_content_Font.FontHeightInPoints = 9; //字体大小
|
|
|
|
ICellStyle borderStyle = hssfworkbook.CreateCellStyle();
|
|
borderStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle.Alignment = HorizontalAlignment.Center;
|
|
borderStyle.VerticalAlignment = VerticalAlignment.Center;
|
|
borderStyle.SetFont(cs_content_Font);
|
|
|
|
ICellStyle borderStyle1 = hssfworkbook.CreateCellStyle();
|
|
borderStyle1.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle1.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle1.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle1.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle1.Alignment = HorizontalAlignment.Left;
|
|
borderStyle1.SetFont(cs_content_Font);
|
|
|
|
IDataFormat dataformat = hssfworkbook.CreateDataFormat();
|
|
ICellStyle styleDate = hssfworkbook.CreateCellStyle();
|
|
styleDate.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
styleDate.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
styleDate.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
styleDate.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
styleDate.Alignment = HorizontalAlignment.Center;
|
|
styleDate.VerticalAlignment = VerticalAlignment.Center;
|
|
styleDate.SetFont(cs_content_Font);
|
|
styleDate.DataFormat = dataformat.GetFormat("yyyy/m/d");
|
|
|
|
//var docReport = from x in Funs.DB.View_Report_DocumentationStatusMC select x;
|
|
//if (this.drpJobStatus.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpJobStatus.SelectedValue))
|
|
//{
|
|
// docReport = from x in docReport where drpJobStatus.SelectedValueArray.Contains(x.ProjectControl_JobStatus) select x;
|
|
//}
|
|
//if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
|
|
//{
|
|
// docReport = from x in docReport where x.ProjectControl_JobNo.StartsWith(this.txtJobNo.Text.Trim()) select x;
|
|
// //docReport = from x in docReport where x.ProjectControl_JobNo.Contains(this.txtJobNo.Text.Trim()) select x;
|
|
//}
|
|
//if (!string.IsNullOrEmpty(this.txtJobReveiveDate.Text.Trim()))
|
|
//{
|
|
// docReport = from x in docReport where x.PM_MA_JobReveive >= Convert.ToDateTime(this.txtJobReveiveDate.Text.Trim()) select x;
|
|
//}
|
|
//var list = (docReport.OrderByDescending(x => x.ProjectControl_JobNo).ThenBy(x => x.Phase)).ToList();
|
|
if (list.Count > 0)
|
|
{
|
|
int totalNum = list.Count;
|
|
var rowIndex = 2;
|
|
foreach (var itemOver in list)
|
|
{
|
|
if (reportModel.GetRow(rowIndex) == null) reportModel.CreateRow(rowIndex);
|
|
|
|
#region 列赋值
|
|
//Job No.
|
|
if (reportModel.GetRow(rowIndex).GetCell(0) == null) reportModel.GetRow(rowIndex).CreateCell(0);
|
|
//if (rowIndex >= 4 && (rowIndex - 1) % 3 == 0)
|
|
//{
|
|
// reportModel.AddMergedRegion(new CellRangeAddress(rowIndex - 2, rowIndex, 0, 0));
|
|
//}
|
|
reportModel.GetRow(rowIndex).GetCell(0).SetCellValue(itemOver.ProjectControl_JobNo);
|
|
reportModel.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
|
|
reportModel.GetRow(rowIndex).GetCell(0).CellStyle = borderStyle;
|
|
|
|
//PM
|
|
if (reportModel.GetRow(rowIndex).GetCell(1) == null) reportModel.GetRow(rowIndex).CreateCell(1);
|
|
//if (rowIndex >= 4 && (rowIndex - 1) % 3 == 0)
|
|
//{
|
|
// reportModel.AddMergedRegion(new CellRangeAddress(rowIndex - 2, rowIndex, 1, 1));
|
|
//}
|
|
reportModel.GetRow(rowIndex).GetCell(1).SetCellValue(itemOver.ProjectControl_ProjectManager);
|
|
reportModel.GetRow(rowIndex).GetCell(1).CellStyle = borderStyle;
|
|
|
|
//Lead By
|
|
if (reportModel.GetRow(rowIndex).GetCell(2) == null) reportModel.GetRow(rowIndex).CreateCell(2);
|
|
//if (rowIndex >= 4 && (rowIndex - 1) % 3 == 0)
|
|
//{
|
|
// reportModel.AddMergedRegion(new CellRangeAddress(rowIndex - 2, rowIndex, 2, 2));
|
|
//}
|
|
reportModel.GetRow(rowIndex).GetCell(2).SetCellValue(itemOver.ProjectControl_LeadByName);
|
|
reportModel.GetRow(rowIndex).GetCell(2).CellStyle = borderStyle;
|
|
|
|
//BU Code
|
|
if (reportModel.GetRow(rowIndex).GetCell(3) == null) reportModel.GetRow(rowIndex).CreateCell(3);
|
|
//if (rowIndex >= 4 && (rowIndex - 1) % 3 == 0)
|
|
//{
|
|
// reportModel.AddMergedRegion(new CellRangeAddress(rowIndex - 2, rowIndex, 3, 3));
|
|
//}
|
|
reportModel.GetRow(rowIndex).GetCell(3).SetCellValue(itemOver.ProjectControl_BUCode);
|
|
reportModel.GetRow(rowIndex).GetCell(3).CellStyle = borderStyle;
|
|
|
|
//MC Date
|
|
if (reportModel.GetRow(rowIndex).GetCell(4) == null) reportModel.GetRow(rowIndex).CreateCell(4);
|
|
//if (rowIndex >= 4 && (rowIndex - 1) % 3 == 0)
|
|
//{
|
|
// reportModel.AddMergedRegion(new CellRangeAddress(rowIndex - 2, rowIndex, 4, 4));
|
|
//}
|
|
if (!string.IsNullOrEmpty(itemOver.MC))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(4).SetCellValue((DateTime)Convert.ToDateTime(itemOver.MC));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(4).CellStyle = styleDate;
|
|
|
|
//Status
|
|
if (reportModel.GetRow(rowIndex).GetCell(5) == null) reportModel.GetRow(rowIndex).CreateCell(5);
|
|
//if (rowIndex >= 4 && (rowIndex - 1) % 3 == 0)
|
|
//{
|
|
// reportModel.AddMergedRegion(new CellRangeAddress(rowIndex - 2, rowIndex, 5, 5));
|
|
//}
|
|
reportModel.GetRow(rowIndex).GetCell(5).SetCellValue(itemOver.ProjectControl_JobStatus);
|
|
reportModel.GetRow(rowIndex).GetCell(5).CellStyle = borderStyle;
|
|
|
|
//Job Type
|
|
if (reportModel.GetRow(rowIndex).GetCell(6) == null) reportModel.GetRow(rowIndex).CreateCell(6);
|
|
//if (rowIndex >= 4 && (rowIndex - 1) % 3 == 0)
|
|
//{
|
|
// reportModel.AddMergedRegion(new CellRangeAddress(rowIndex - 2, rowIndex, 6, 6));
|
|
//}
|
|
reportModel.GetRow(rowIndex).GetCell(6).SetCellValue(itemOver.ProjectControl_JobType);
|
|
reportModel.GetRow(rowIndex).GetCell(6).CellStyle = borderStyle;
|
|
|
|
//TDC
|
|
if (reportModel.GetRow(rowIndex).GetCell(7) == null) reportModel.GetRow(rowIndex).CreateCell(7);
|
|
//if (rowIndex >= 4 && (rowIndex - 1) % 3 == 0)
|
|
//{
|
|
// reportModel.AddMergedRegion(new CellRangeAddress(rowIndex - 2, rowIndex, 7, 7));
|
|
//}
|
|
reportModel.GetRow(rowIndex).GetCell(7).SetCellValue(itemOver.ProjectControl_TDCManager);
|
|
reportModel.GetRow(rowIndex).GetCell(7).CellStyle = borderStyle;
|
|
|
|
//Phase
|
|
if (reportModel.GetRow(rowIndex).GetCell(8) == null) reportModel.GetRow(rowIndex).CreateCell(8);
|
|
reportModel.GetRow(rowIndex).GetCell(8).SetCellValue(itemOver.Phase);
|
|
reportModel.GetRow(rowIndex).GetCell(8).CellStyle = borderStyle1;
|
|
//Process
|
|
if (reportModel.GetRow(rowIndex).GetCell(9) == null) reportModel.GetRow(rowIndex).CreateCell(9);
|
|
if (!string.IsNullOrEmpty(itemOver.Process))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(9).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Process));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(9).CellStyle = styleDate;
|
|
//Plumbling
|
|
if (reportModel.GetRow(rowIndex).GetCell(10) == null) reportModel.GetRow(rowIndex).CreateCell(10);
|
|
if (!string.IsNullOrEmpty(itemOver.Plumbling))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(10).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Plumbling));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(10).CellStyle = styleDate;
|
|
//Equipment
|
|
if (reportModel.GetRow(rowIndex).GetCell(11) == null) reportModel.GetRow(rowIndex).CreateCell(11);
|
|
if (!string.IsNullOrEmpty(itemOver.Equipment))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(11).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Equipment));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(11).CellStyle = styleDate;
|
|
//Piping
|
|
if (reportModel.GetRow(rowIndex).GetCell(12) == null) reportModel.GetRow(rowIndex).CreateCell(12);
|
|
if (!string.IsNullOrEmpty(itemOver.Piping))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(12).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Piping));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(12).CellStyle = styleDate;
|
|
//HSE
|
|
if (reportModel.GetRow(rowIndex).GetCell(13) == null) reportModel.GetRow(rowIndex).CreateCell(13);
|
|
if (!string.IsNullOrEmpty(itemOver.HSE))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(13).SetCellValue((DateTime)Convert.ToDateTime(itemOver.HSE));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(13).CellStyle = styleDate;
|
|
//Electrical
|
|
if (reportModel.GetRow(rowIndex).GetCell(14) == null) reportModel.GetRow(rowIndex).CreateCell(14);
|
|
if (!string.IsNullOrEmpty(itemOver.Electrical))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(14).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Electrical));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(14).CellStyle = styleDate;
|
|
//Communication
|
|
if (reportModel.GetRow(rowIndex).GetCell(15) == null) reportModel.GetRow(rowIndex).CreateCell(15);
|
|
if (!string.IsNullOrEmpty(itemOver.Communication))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(15).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Communication));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(15).CellStyle = styleDate;
|
|
//Instrument
|
|
if (reportModel.GetRow(rowIndex).GetCell(16) == null) reportModel.GetRow(rowIndex).CreateCell(16);
|
|
if (!string.IsNullOrEmpty(itemOver.Instrument))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(16).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Instrument));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(16).CellStyle = styleDate;
|
|
// Civil
|
|
if (reportModel.GetRow(rowIndex).GetCell(17) == null) reportModel.GetRow(rowIndex).CreateCell(17);
|
|
if (!string.IsNullOrEmpty(itemOver.Civil))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(17).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Civil));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(17).CellStyle = styleDate;
|
|
//Architectral
|
|
if (reportModel.GetRow(rowIndex).GetCell(18) == null) reportModel.GetRow(rowIndex).CreateCell(18);
|
|
if (!string.IsNullOrEmpty(itemOver.Architectral))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(18).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Architectral));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(18).CellStyle = styleDate;
|
|
// HVAC
|
|
if (reportModel.GetRow(rowIndex).GetCell(19) == null) reportModel.GetRow(rowIndex).CreateCell(19);
|
|
if (!string.IsNullOrEmpty(itemOver.HVAC))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(19).SetCellValue((DateTime)Convert.ToDateTime(itemOver.HVAC));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(19).CellStyle = styleDate;
|
|
// MasterpLanning
|
|
if (reportModel.GetRow(rowIndex).GetCell(20) == null) reportModel.GetRow(rowIndex).CreateCell(20);
|
|
if (!string.IsNullOrEmpty(itemOver.MasterpLanning))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(20).SetCellValue((DateTime)Convert.ToDateTime(itemOver.MasterpLanning));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(20).CellStyle = styleDate;
|
|
//ALL
|
|
if (reportModel.GetRow(rowIndex).GetCell(21) == null) reportModel.GetRow(rowIndex).CreateCell(21);
|
|
if (!string.IsNullOrEmpty(itemOver.ALLS))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(21).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ALLS));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(21).CellStyle = styleDate;
|
|
|
|
#endregion
|
|
|
|
if ((int)(95 * (rowIndex-2) / totalNum) > percent)
|
|
{
|
|
percent = (int)(100 * (rowIndex - 2) / totalNum);
|
|
}
|
|
|
|
rowIndex++;
|
|
}
|
|
}
|
|
#endregion
|
|
reportModel.ForceFormulaRecalculation = true;
|
|
|
|
using (FileStream filess = File.OpenWrite(ReportFileName))
|
|
{
|
|
hssfworkbook.Write(filess);
|
|
//hssfworkbook.Close();
|
|
//filess.Flush();
|
|
//filess.Close();
|
|
}
|
|
percent = 100;
|
|
url = ReportFileName.Replace(Server.MapPath("~/"), "");
|
|
//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=P22_Document_Status_MC_" + Server.UrlEncode(DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"));
|
|
//// 添加头信息,指定文件大小,让浏览器能够显示下载进度
|
|
//Response.AddHeader("Content-Length", filet.Length.ToString());
|
|
//// 指定返回的是一个不能被客户端读取的流,必须被下载
|
|
//Response.ContentType = "application/ms-excel";
|
|
//// 把文件流发送到客户端
|
|
//Response.WriteFile(filet.FullName);
|
|
//// 停止页面的执行
|
|
//Response.End();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 导出IFC_KPI
|
|
/// <summary>
|
|
/// 导出按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnExportIFC_KPI_Click(object sender, EventArgs e)
|
|
{
|
|
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
|
|
//模板文件
|
|
string TempletFileName = rootPath + "Documentation_Status_MC_IFC_KPI.xlsx";
|
|
//导出文件
|
|
string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
|
|
if (!Directory.Exists(filePath))
|
|
{
|
|
Directory.CreateDirectory(filePath);
|
|
}
|
|
string ReportFileName = filePath + "out.xlsx";
|
|
|
|
FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
|
|
XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
|
|
|
|
#region Documentation_Status_Takeover
|
|
XSSFSheet reportModel = (XSSFSheet)hssfworkbook.GetSheet("Documentation_Status_Report");
|
|
|
|
XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
|
|
cs_content_Font.FontName = "sans-serif";//字体
|
|
cs_content_Font.FontHeightInPoints = 9; //字体大小
|
|
|
|
ICellStyle borderStyle = hssfworkbook.CreateCellStyle();
|
|
borderStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle.Alignment = HorizontalAlignment.Center;
|
|
borderStyle.VerticalAlignment = VerticalAlignment.Center;
|
|
borderStyle.SetFont(cs_content_Font);
|
|
|
|
ICellStyle borderStyle1 = hssfworkbook.CreateCellStyle();
|
|
borderStyle1.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle1.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle1.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle1.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle1.Alignment = HorizontalAlignment.Left;
|
|
borderStyle1.SetFont(cs_content_Font);
|
|
|
|
IDataFormat dataformat = hssfworkbook.CreateDataFormat();
|
|
ICellStyle styleDate = hssfworkbook.CreateCellStyle();
|
|
styleDate.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
styleDate.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
styleDate.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
styleDate.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
styleDate.Alignment = HorizontalAlignment.Center;
|
|
styleDate.VerticalAlignment = VerticalAlignment.Center;
|
|
styleDate.SetFont(cs_content_Font);
|
|
styleDate.DataFormat = dataformat.GetFormat("yyyy/m/d");
|
|
|
|
var docReport = from x in Funs.DB.View_Report_DocumentationStatusMC_OUT select x;
|
|
if (this.drpJobStatus.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpJobStatus.SelectedValue))
|
|
{
|
|
docReport = from x in docReport where drpJobStatus.SelectedValueArray.Contains(x.ProjectControl_JobStatus) select x;
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
|
|
{
|
|
docReport = from x in docReport where x.ProjectControl_JobNo.StartsWith(this.txtJobNo.Text.Trim()) select x;
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtJobReveiveDate.Text.Trim()))
|
|
{
|
|
docReport = from x in docReport where x.PM_MA_JobReveive >= Convert.ToDateTime(this.txtJobReveiveDate.Text.Trim()) select x;
|
|
}
|
|
|
|
var list = (docReport.OrderByDescending(x => x.ProjectControl_JobNo).ThenBy(x => x.Phase)).ToList();
|
|
if (list.Count > 0)
|
|
{
|
|
var rowIndex = 2;
|
|
foreach (var itemOver in list)
|
|
{
|
|
if (reportModel.GetRow(rowIndex) == null) reportModel.CreateRow(rowIndex);
|
|
|
|
#region 列赋值
|
|
//Job No.
|
|
if (reportModel.GetRow(rowIndex).GetCell(0) == null) reportModel.GetRow(rowIndex).CreateCell(0);
|
|
reportModel.GetRow(rowIndex).GetCell(0).SetCellValue(itemOver.ProjectControl_JobNo);
|
|
reportModel.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
|
|
reportModel.GetRow(rowIndex).GetCell(0).CellStyle = borderStyle;
|
|
|
|
//PM
|
|
if (reportModel.GetRow(rowIndex).GetCell(1) == null) reportModel.GetRow(rowIndex).CreateCell(1);
|
|
reportModel.GetRow(rowIndex).GetCell(1).SetCellValue(itemOver.ProjectControl_ProjectManager);
|
|
reportModel.GetRow(rowIndex).GetCell(1).CellStyle = borderStyle;
|
|
|
|
//Lead By
|
|
if (reportModel.GetRow(rowIndex).GetCell(2) == null) reportModel.GetRow(rowIndex).CreateCell(2);
|
|
reportModel.GetRow(rowIndex).GetCell(2).SetCellValue(itemOver.ProjectControl_LeadByName);
|
|
reportModel.GetRow(rowIndex).GetCell(2).CellStyle = borderStyle;
|
|
|
|
//BU Code
|
|
if (reportModel.GetRow(rowIndex).GetCell(3) == null) reportModel.GetRow(rowIndex).CreateCell(3);
|
|
reportModel.GetRow(rowIndex).GetCell(3).SetCellValue(itemOver.ProjectControl_BUCode);
|
|
reportModel.GetRow(rowIndex).GetCell(3).CellStyle = borderStyle;
|
|
|
|
//MC Date
|
|
if (reportModel.GetRow(rowIndex).GetCell(4) == null) reportModel.GetRow(rowIndex).CreateCell(4);
|
|
if (!string.IsNullOrEmpty(itemOver.MC))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(4).SetCellValue((DateTime)Convert.ToDateTime(itemOver.MC));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(4).CellStyle = styleDate;
|
|
|
|
//Status
|
|
if (reportModel.GetRow(rowIndex).GetCell(5) == null) reportModel.GetRow(rowIndex).CreateCell(5);
|
|
reportModel.GetRow(rowIndex).GetCell(5).SetCellValue(itemOver.ProjectControl_JobStatus);
|
|
reportModel.GetRow(rowIndex).GetCell(5).CellStyle = borderStyle;
|
|
|
|
//Job Type
|
|
if (reportModel.GetRow(rowIndex).GetCell(6) == null) reportModel.GetRow(rowIndex).CreateCell(6);
|
|
reportModel.GetRow(rowIndex).GetCell(6).SetCellValue(itemOver.ProjectControl_JobType);
|
|
reportModel.GetRow(rowIndex).GetCell(6).CellStyle = borderStyle;
|
|
|
|
//TDC
|
|
if (reportModel.GetRow(rowIndex).GetCell(7) == null) reportModel.GetRow(rowIndex).CreateCell(7);
|
|
reportModel.GetRow(rowIndex).GetCell(7).SetCellValue(itemOver.ProjectControl_TDCManager);
|
|
reportModel.GetRow(rowIndex).GetCell(7).CellStyle = borderStyle;
|
|
|
|
//Phase
|
|
if (reportModel.GetRow(rowIndex).GetCell(8) == null) reportModel.GetRow(rowIndex).CreateCell(8);
|
|
reportModel.GetRow(rowIndex).GetCell(8).SetCellValue(itemOver.Phase);
|
|
reportModel.GetRow(rowIndex).GetCell(8).CellStyle = borderStyle1;
|
|
//Process
|
|
if (reportModel.GetRow(rowIndex).GetCell(9) == null) reportModel.GetRow(rowIndex).CreateCell(9);
|
|
if (!string.IsNullOrEmpty(itemOver.Process))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(9).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Process));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(9).CellStyle = styleDate;
|
|
//Plumbling
|
|
if (reportModel.GetRow(rowIndex).GetCell(10) == null) reportModel.GetRow(rowIndex).CreateCell(10);
|
|
if (!string.IsNullOrEmpty(itemOver.Plumbling))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(10).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Plumbling));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(10).CellStyle = styleDate;
|
|
//Equipment
|
|
if (reportModel.GetRow(rowIndex).GetCell(11) == null) reportModel.GetRow(rowIndex).CreateCell(11);
|
|
if (!string.IsNullOrEmpty(itemOver.Equipment))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(11).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Equipment));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(11).CellStyle = styleDate;
|
|
//Piping
|
|
if (reportModel.GetRow(rowIndex).GetCell(12) == null) reportModel.GetRow(rowIndex).CreateCell(12);
|
|
if (!string.IsNullOrEmpty(itemOver.Piping))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(12).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Piping));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(12).CellStyle = styleDate;
|
|
//HSE
|
|
if (reportModel.GetRow(rowIndex).GetCell(13) == null) reportModel.GetRow(rowIndex).CreateCell(13);
|
|
if (!string.IsNullOrEmpty(itemOver.HSE))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(13).SetCellValue((DateTime)Convert.ToDateTime(itemOver.HSE));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(13).CellStyle = styleDate;
|
|
//Electrical
|
|
if (reportModel.GetRow(rowIndex).GetCell(14) == null) reportModel.GetRow(rowIndex).CreateCell(14);
|
|
if (!string.IsNullOrEmpty(itemOver.Electrical))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(14).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Electrical));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(14).CellStyle = styleDate;
|
|
//Communication
|
|
if (reportModel.GetRow(rowIndex).GetCell(15) == null) reportModel.GetRow(rowIndex).CreateCell(15);
|
|
if (!string.IsNullOrEmpty(itemOver.Communication))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(15).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Communication));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(15).CellStyle = styleDate;
|
|
//Instrument
|
|
if (reportModel.GetRow(rowIndex).GetCell(16) == null) reportModel.GetRow(rowIndex).CreateCell(16);
|
|
if (!string.IsNullOrEmpty(itemOver.Instrument))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(16).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Instrument));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(16).CellStyle = styleDate;
|
|
// Civil
|
|
if (reportModel.GetRow(rowIndex).GetCell(17) == null) reportModel.GetRow(rowIndex).CreateCell(17);
|
|
if (!string.IsNullOrEmpty(itemOver.Civil))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(17).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Civil));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(17).CellStyle = styleDate;
|
|
//Architectral
|
|
if (reportModel.GetRow(rowIndex).GetCell(18) == null) reportModel.GetRow(rowIndex).CreateCell(18);
|
|
if (!string.IsNullOrEmpty(itemOver.Architectral))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(18).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Architectral));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(18).CellStyle = styleDate;
|
|
// HVAC
|
|
if (reportModel.GetRow(rowIndex).GetCell(19) == null) reportModel.GetRow(rowIndex).CreateCell(19);
|
|
if (!string.IsNullOrEmpty(itemOver.HVAC))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(19).SetCellValue((DateTime)Convert.ToDateTime(itemOver.HVAC));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(19).CellStyle = styleDate;
|
|
// MasterpLanning
|
|
if (reportModel.GetRow(rowIndex).GetCell(20) == null) reportModel.GetRow(rowIndex).CreateCell(20);
|
|
if (!string.IsNullOrEmpty(itemOver.MasterpLanning))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(20).SetCellValue((DateTime)Convert.ToDateTime(itemOver.MasterpLanning));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(20).CellStyle = styleDate;
|
|
//ALL
|
|
if (reportModel.GetRow(rowIndex).GetCell(21) == null) reportModel.GetRow(rowIndex).CreateCell(21);
|
|
if (!string.IsNullOrEmpty(itemOver.ALLS))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(21).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ALLS));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(21).CellStyle = styleDate;
|
|
|
|
//P1_Process
|
|
if (reportModel.GetRow(rowIndex).GetCell(22) == null) reportModel.GetRow(rowIndex).CreateCell(22);
|
|
reportModel.GetRow(rowIndex).GetCell(22).SetCellValue(itemOver.P1_Process);
|
|
reportModel.GetRow(rowIndex).GetCell(22).CellStyle = borderStyle;
|
|
|
|
//P3_Plumbing_FF
|
|
if (reportModel.GetRow(rowIndex).GetCell(23) == null) reportModel.GetRow(rowIndex).CreateCell(23);
|
|
reportModel.GetRow(rowIndex).GetCell(23).SetCellValue(itemOver.P3_Plumbing_FF);
|
|
reportModel.GetRow(rowIndex).GetCell(23).CellStyle = borderStyle;
|
|
|
|
//P2_Mech_Equi
|
|
if (reportModel.GetRow(rowIndex).GetCell(24) == null) reportModel.GetRow(rowIndex).CreateCell(24);
|
|
reportModel.GetRow(rowIndex).GetCell(24).SetCellValue(itemOver.P2_Mech_Equi);
|
|
reportModel.GetRow(rowIndex).GetCell(24).CellStyle = borderStyle;
|
|
|
|
//P4_Piping
|
|
if (reportModel.GetRow(rowIndex).GetCell(25) == null) reportModel.GetRow(rowIndex).CreateCell(25);
|
|
reportModel.GetRow(rowIndex).GetCell(25).SetCellValue(itemOver.P4_Piping);
|
|
reportModel.GetRow(rowIndex).GetCell(25).CellStyle = borderStyle;
|
|
|
|
//A2_Electrical
|
|
if (reportModel.GetRow(rowIndex).GetCell(26) == null) reportModel.GetRow(rowIndex).CreateCell(26);
|
|
reportModel.GetRow(rowIndex).GetCell(26).SetCellValue(itemOver.A2_Electrical);
|
|
reportModel.GetRow(rowIndex).GetCell(26).CellStyle = borderStyle;
|
|
|
|
//A3_Telec
|
|
if (reportModel.GetRow(rowIndex).GetCell(27) == null) reportModel.GetRow(rowIndex).CreateCell(27);
|
|
reportModel.GetRow(rowIndex).GetCell(27).SetCellValue(itemOver.A3_Telec);
|
|
reportModel.GetRow(rowIndex).GetCell(27).CellStyle = borderStyle;
|
|
|
|
//A1_Instrument
|
|
if (reportModel.GetRow(rowIndex).GetCell(28) == null) reportModel.GetRow(rowIndex).CreateCell(28);
|
|
reportModel.GetRow(rowIndex).GetCell(28).SetCellValue(itemOver.A1_Instrument);
|
|
reportModel.GetRow(rowIndex).GetCell(28).CellStyle = borderStyle;
|
|
|
|
//C1_Civil
|
|
if (reportModel.GetRow(rowIndex).GetCell(29) == null) reportModel.GetRow(rowIndex).CreateCell(29);
|
|
reportModel.GetRow(rowIndex).GetCell(29).SetCellValue(itemOver.C1_Civil);
|
|
reportModel.GetRow(rowIndex).GetCell(29).CellStyle = borderStyle;
|
|
|
|
//C3_Architectral
|
|
if (reportModel.GetRow(rowIndex).GetCell(30) == null) reportModel.GetRow(rowIndex).CreateCell(30);
|
|
reportModel.GetRow(rowIndex).GetCell(30).SetCellValue(itemOver.C3_Architectral);
|
|
reportModel.GetRow(rowIndex).GetCell(30).CellStyle = borderStyle;
|
|
|
|
//C4_HVAC
|
|
if (reportModel.GetRow(rowIndex).GetCell(31) == null) reportModel.GetRow(rowIndex).CreateCell(31);
|
|
reportModel.GetRow(rowIndex).GetCell(31).SetCellValue(itemOver.C4_HVAC);
|
|
reportModel.GetRow(rowIndex).GetCell(31).CellStyle = borderStyle;
|
|
|
|
//C2_MasterPlanning
|
|
if (reportModel.GetRow(rowIndex).GetCell(32) == null) reportModel.GetRow(rowIndex).CreateCell(32);
|
|
reportModel.GetRow(rowIndex).GetCell(32).SetCellValue(itemOver.C2_MasterPlanning);
|
|
reportModel.GetRow(rowIndex).GetCell(32).CellStyle = borderStyle;
|
|
|
|
//ApprSch
|
|
if (reportModel.GetRow(rowIndex).GetCell(33) == null) reportModel.GetRow(rowIndex).CreateCell(33);
|
|
if (!string.IsNullOrEmpty(itemOver.ApprSch))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(33).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ApprSch));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(33).CellStyle = styleDate;
|
|
//ApprAct
|
|
if (reportModel.GetRow(rowIndex).GetCell(34) == null) reportModel.GetRow(rowIndex).CreateCell(34);
|
|
if (!string.IsNullOrEmpty(itemOver.ApprAct))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(34).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ApprAct));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(34).CellStyle = styleDate;
|
|
//Detail_Eng_Civil_Sch_Start
|
|
if (reportModel.GetRow(rowIndex).GetCell(35) == null) reportModel.GetRow(rowIndex).CreateCell(35);
|
|
if (!string.IsNullOrEmpty(itemOver.Detail_Eng_Civil_Sch_Start))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(35).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Detail_Eng_Civil_Sch_Start));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(35).CellStyle = styleDate;
|
|
//Detail_Eng_Civil_Sch_End
|
|
if (reportModel.GetRow(rowIndex).GetCell(36) == null) reportModel.GetRow(rowIndex).CreateCell(36);
|
|
if (!string.IsNullOrEmpty(itemOver.Detail_Eng_Civil_Sch_End))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(36).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Detail_Eng_Civil_Sch_End));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(36).CellStyle = styleDate;
|
|
//PROJ_DE_CIVIL_ACU_START_DATE
|
|
if (reportModel.GetRow(rowIndex).GetCell(37) == null) reportModel.GetRow(rowIndex).CreateCell(37);
|
|
if (!string.IsNullOrEmpty(itemOver.PROJ_DE_CIVIL_ACU_START_DATE))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(37).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PROJ_DE_CIVIL_ACU_START_DATE));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(37).CellStyle = styleDate;
|
|
//PROJ_DE_CIVIL_ACU_END_DATE
|
|
if (reportModel.GetRow(rowIndex).GetCell(38) == null) reportModel.GetRow(rowIndex).CreateCell(38);
|
|
if (!string.IsNullOrEmpty(itemOver.PROJ_DE_CIVIL_ACU_END_DATE))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(38).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PROJ_DE_CIVIL_ACU_END_DATE));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(38).CellStyle = styleDate;
|
|
//Detail_Eng_Mech_EI_Sch_Start
|
|
if (reportModel.GetRow(rowIndex).GetCell(39) == null) reportModel.GetRow(rowIndex).CreateCell(39);
|
|
if (!string.IsNullOrEmpty(itemOver.Detail_Eng_Mech_EI_Sch_Start))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(39).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Detail_Eng_Mech_EI_Sch_Start));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(39).CellStyle = styleDate;
|
|
//PROJ_DE_ME_SCH_END_DATE
|
|
if (reportModel.GetRow(rowIndex).GetCell(40) == null) reportModel.GetRow(rowIndex).CreateCell(40);
|
|
if (!string.IsNullOrEmpty(itemOver.PROJ_DE_ME_SCH_END_DATE))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(40).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PROJ_DE_ME_SCH_END_DATE));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(40).CellStyle = styleDate;
|
|
//Detail_Eng_Mech_EI_Sch_End
|
|
if (reportModel.GetRow(rowIndex).GetCell(41) == null) reportModel.GetRow(rowIndex).CreateCell(41);
|
|
if (!string.IsNullOrEmpty(itemOver.Detail_Eng_Mech_EI_Sch_End))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(41).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Detail_Eng_Mech_EI_Sch_End));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(41).CellStyle = styleDate;
|
|
//PROJ_DE_ME_ACU_END_DATE
|
|
if (reportModel.GetRow(rowIndex).GetCell(42) == null) reportModel.GetRow(rowIndex).CreateCell(42);
|
|
if (!string.IsNullOrEmpty(itemOver.PROJ_DE_ME_ACU_END_DATE))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(42).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PROJ_DE_ME_ACU_END_DATE));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(42).CellStyle = styleDate;
|
|
//PM_General_CDI
|
|
if (reportModel.GetRow(rowIndex).GetCell(43) == null) reportModel.GetRow(rowIndex).CreateCell(43);
|
|
reportModel.GetRow(rowIndex).GetCell(43).SetCellValue(itemOver.PM_General_CDI);
|
|
reportModel.GetRow(rowIndex).GetCell(43).CellStyle = borderStyle;
|
|
|
|
//OutSourceType
|
|
if (reportModel.GetRow(rowIndex).GetCell(44) == null) reportModel.GetRow(rowIndex).CreateCell(44);
|
|
reportModel.GetRow(rowIndex).GetCell(44).SetCellValue(itemOver.OutSourceType);
|
|
reportModel.GetRow(rowIndex).GetCell(44).CellStyle = borderStyle;
|
|
#endregion
|
|
|
|
rowIndex++;
|
|
}
|
|
}
|
|
#endregion
|
|
reportModel.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=P22_Document_Status_IFC_KPI_" + Server.UrlEncode(DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"));
|
|
// 添加头信息,指定文件大小,让浏览器能够显示下载进度
|
|
Response.AddHeader("Content-Length", filet.Length.ToString());
|
|
// 指定返回的是一个不能被客户端读取的流,必须被下载
|
|
Response.ContentType = "application/ms-excel";
|
|
// 把文件流发送到客户端
|
|
Response.WriteFile(filet.FullName);
|
|
// 停止页面的执行
|
|
Response.End();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 导出IFC
|
|
/// <summary>
|
|
/// 导出按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnExportIFC_Click(object sender, EventArgs e)
|
|
{
|
|
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
|
|
//模板文件
|
|
string TempletFileName = rootPath + "Document_Status_IFC.xlsx";
|
|
//导出文件
|
|
string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
|
|
if (!Directory.Exists(filePath))
|
|
{
|
|
Directory.CreateDirectory(filePath);
|
|
}
|
|
string ReportFileName = filePath + "out.xlsx";
|
|
|
|
FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
|
|
XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
|
|
|
|
#region Documentation_Status_Takeover
|
|
XSSFSheet reportModel = (XSSFSheet)hssfworkbook.GetSheet("Documentation_Status_Report_IFC");
|
|
|
|
XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
|
|
cs_content_Font.FontName = "sans-serif";//字体
|
|
cs_content_Font.FontHeightInPoints = 9; //字体大小
|
|
|
|
ICellStyle borderStyle = hssfworkbook.CreateCellStyle();
|
|
borderStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle.Alignment = HorizontalAlignment.Center;
|
|
borderStyle.SetFont(cs_content_Font);
|
|
|
|
ICellStyle borderStyle1 = hssfworkbook.CreateCellStyle();
|
|
borderStyle1.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle1.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle1.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle1.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
borderStyle1.Alignment = HorizontalAlignment.Left;
|
|
borderStyle1.SetFont(cs_content_Font);
|
|
|
|
IDataFormat dataformat = hssfworkbook.CreateDataFormat();
|
|
ICellStyle styleDate = hssfworkbook.CreateCellStyle();
|
|
styleDate.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
styleDate.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
styleDate.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
styleDate.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
styleDate.Alignment = HorizontalAlignment.Center;
|
|
styleDate.VerticalAlignment = VerticalAlignment.Center;
|
|
styleDate.SetFont(cs_content_Font);
|
|
styleDate.DataFormat = dataformat.GetFormat("yyyy/m/d");
|
|
|
|
var docReport = from x in Funs.DB.View_Report_DocumentationStatusIFC select x;
|
|
if (this.drpJobStatus.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpJobStatus.SelectedValue))
|
|
{
|
|
docReport = from x in docReport where drpJobStatus.SelectedValueArray.Contains(x.ProjectControl_JobStatus) select x;
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
|
|
{
|
|
docReport = from x in docReport where x.ProjectControl_JobNo.StartsWith(this.txtJobNo.Text.Trim()) select x;
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtJobReveiveDate.Text.Trim()))
|
|
{
|
|
docReport = from x in docReport where x.PM_MA_JobReveive >= Convert.ToDateTime(this.txtJobReveiveDate.Text.Trim()) select x;
|
|
}
|
|
|
|
var list = (docReport.OrderByDescending(x => x.ProjectControl_JobNo)).ToList();
|
|
|
|
if (list.Count > 0)
|
|
{
|
|
var rowIndex = 3;
|
|
foreach (var itemOver in list)
|
|
{
|
|
if (reportModel.GetRow(rowIndex) == null) reportModel.CreateRow(rowIndex);
|
|
|
|
#region 列赋值
|
|
//Job No.
|
|
if (reportModel.GetRow(rowIndex).GetCell(0) == null) reportModel.GetRow(rowIndex).CreateCell(0);
|
|
reportModel.GetRow(rowIndex).GetCell(0).SetCellValue(itemOver.ProjectControl_JobNo);
|
|
reportModel.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
|
|
reportModel.GetRow(rowIndex).GetCell(0).CellStyle = borderStyle;
|
|
|
|
//PM
|
|
if (reportModel.GetRow(rowIndex).GetCell(1) == null) reportModel.GetRow(rowIndex).CreateCell(1);
|
|
reportModel.GetRow(rowIndex).GetCell(1).SetCellValue(itemOver.ProjectControl_ProjectManager);
|
|
reportModel.GetRow(rowIndex).GetCell(1).CellStyle = borderStyle;
|
|
|
|
//Lead By
|
|
if (reportModel.GetRow(rowIndex).GetCell(2) == null) reportModel.GetRow(rowIndex).CreateCell(2);
|
|
reportModel.GetRow(rowIndex).GetCell(2).SetCellValue(itemOver.ProjectControl_LeadByName);
|
|
reportModel.GetRow(rowIndex).GetCell(2).CellStyle = borderStyle;
|
|
|
|
//BU Code
|
|
if (reportModel.GetRow(rowIndex).GetCell(3) == null) reportModel.GetRow(rowIndex).CreateCell(3);
|
|
reportModel.GetRow(rowIndex).GetCell(3).SetCellValue(itemOver.ProjectControl_BUCode);
|
|
reportModel.GetRow(rowIndex).GetCell(3).CellStyle = borderStyle;
|
|
|
|
//MC Date
|
|
if (reportModel.GetRow(rowIndex).GetCell(4) == null) reportModel.GetRow(rowIndex).CreateCell(4);
|
|
if (!string.IsNullOrEmpty(itemOver.MC))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(4).SetCellValue((DateTime)Convert.ToDateTime(itemOver.MC));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(4).CellStyle = styleDate;
|
|
|
|
//Status
|
|
if (reportModel.GetRow(rowIndex).GetCell(5) == null) reportModel.GetRow(rowIndex).CreateCell(5);
|
|
reportModel.GetRow(rowIndex).GetCell(5).SetCellValue(itemOver.ProjectControl_JobStatus);
|
|
reportModel.GetRow(rowIndex).GetCell(5).CellStyle = borderStyle;
|
|
|
|
//Job Type
|
|
if (reportModel.GetRow(rowIndex).GetCell(6) == null) reportModel.GetRow(rowIndex).CreateCell(6);
|
|
reportModel.GetRow(rowIndex).GetCell(6).SetCellValue(itemOver.ProjectControl_JobType);
|
|
reportModel.GetRow(rowIndex).GetCell(6).CellStyle = borderStyle;
|
|
|
|
//TDC
|
|
if (reportModel.GetRow(rowIndex).GetCell(7) == null) reportModel.GetRow(rowIndex).CreateCell(7);
|
|
reportModel.GetRow(rowIndex).GetCell(7).SetCellValue(itemOver.ProjectControl_TDCManager);
|
|
reportModel.GetRow(rowIndex).GetCell(7).CellStyle = borderStyle;
|
|
|
|
//Phase
|
|
if (reportModel.GetRow(rowIndex).GetCell(8) == null) reportModel.GetRow(rowIndex).CreateCell(8);
|
|
reportModel.GetRow(rowIndex).GetCell(8).SetCellValue(itemOver.Phase);
|
|
reportModel.GetRow(rowIndex).GetCell(8).CellStyle = borderStyle1;
|
|
|
|
//PlanProcess
|
|
if (reportModel.GetRow(rowIndex).GetCell(9) == null) reportModel.GetRow(rowIndex).CreateCell(9);
|
|
if (!string.IsNullOrEmpty(itemOver.PlanProcess))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(9).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PlanProcess));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(9).CellStyle = styleDate;
|
|
//Process
|
|
if (reportModel.GetRow(rowIndex).GetCell(10) == null) reportModel.GetRow(rowIndex).CreateCell(10);
|
|
if (!string.IsNullOrEmpty(itemOver.Process))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(10).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Process));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(10).CellStyle = styleDate;
|
|
//PlanPlumbling
|
|
if (reportModel.GetRow(rowIndex).GetCell(11) == null) reportModel.GetRow(rowIndex).CreateCell(11);
|
|
if (!string.IsNullOrEmpty(itemOver.PlanPlumbing))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(11).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PlanPlumbing));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(11).CellStyle = styleDate;
|
|
//Plumbling
|
|
if (reportModel.GetRow(rowIndex).GetCell(12) == null) reportModel.GetRow(rowIndex).CreateCell(12);
|
|
if (!string.IsNullOrEmpty(itemOver.Plumbling))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(12).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Plumbling));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(12).CellStyle = styleDate;
|
|
//PlanEquipment
|
|
if (reportModel.GetRow(rowIndex).GetCell(13) == null) reportModel.GetRow(rowIndex).CreateCell(13);
|
|
if (!string.IsNullOrEmpty(itemOver.PlanEquipment))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(13).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PlanEquipment));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(13).CellStyle = styleDate;
|
|
//Equipment
|
|
if (reportModel.GetRow(rowIndex).GetCell(14) == null) reportModel.GetRow(rowIndex).CreateCell(14);
|
|
if (!string.IsNullOrEmpty(itemOver.Equipment))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(14).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Equipment));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(14).CellStyle = styleDate;
|
|
//PlanPiping
|
|
if (reportModel.GetRow(rowIndex).GetCell(15) == null) reportModel.GetRow(rowIndex).CreateCell(15);
|
|
if (!string.IsNullOrEmpty(itemOver.PlanPiping))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(15).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PlanPiping));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(15).CellStyle = styleDate;
|
|
//Piping
|
|
if (reportModel.GetRow(rowIndex).GetCell(16) == null) reportModel.GetRow(rowIndex).CreateCell(16);
|
|
if (!string.IsNullOrEmpty(itemOver.Piping))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(16).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Piping));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(16).CellStyle = styleDate;
|
|
//HSE
|
|
if (reportModel.GetRow(rowIndex).GetCell(17) == null) reportModel.GetRow(rowIndex).CreateCell(17);
|
|
if (!string.IsNullOrEmpty(itemOver.HSE))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(17).SetCellValue((DateTime)Convert.ToDateTime(itemOver.HSE));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(17).CellStyle = styleDate;
|
|
//PlanElectrical
|
|
if (reportModel.GetRow(rowIndex).GetCell(18) == null) reportModel.GetRow(rowIndex).CreateCell(18);
|
|
if (!string.IsNullOrEmpty(itemOver.PlanElectrical))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(18).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PlanElectrical));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(18).CellStyle = styleDate;
|
|
//Electrical
|
|
if (reportModel.GetRow(rowIndex).GetCell(19) == null) reportModel.GetRow(rowIndex).CreateCell(19);
|
|
if (!string.IsNullOrEmpty(itemOver.Electrical))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(19).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Electrical));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(19).CellStyle = styleDate;
|
|
//Communication
|
|
if (reportModel.GetRow(rowIndex).GetCell(20) == null) reportModel.GetRow(rowIndex).CreateCell(20);
|
|
if (!string.IsNullOrEmpty(itemOver.PlanTelecommunication))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(20).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PlanTelecommunication));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(20).CellStyle = styleDate;
|
|
//Communication
|
|
if (reportModel.GetRow(rowIndex).GetCell(21) == null) reportModel.GetRow(rowIndex).CreateCell(21);
|
|
if (!string.IsNullOrEmpty(itemOver.Communication))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(21).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Communication));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(21).CellStyle = styleDate;
|
|
//PlanInstrument
|
|
if (reportModel.GetRow(rowIndex).GetCell(22) == null) reportModel.GetRow(rowIndex).CreateCell(22);
|
|
if (!string.IsNullOrEmpty(itemOver.PlanInstrument))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(22).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PlanInstrument));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(22).CellStyle = styleDate;
|
|
//Instrument
|
|
if (reportModel.GetRow(rowIndex).GetCell(23) == null) reportModel.GetRow(rowIndex).CreateCell(23);
|
|
if (!string.IsNullOrEmpty(itemOver.Instrument))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(23).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Instrument));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(23).CellStyle = styleDate;
|
|
//Civil /Struc.
|
|
if (reportModel.GetRow(rowIndex).GetCell(24) == null) reportModel.GetRow(rowIndex).CreateCell(24);
|
|
if (!string.IsNullOrEmpty(itemOver.PlanCivil))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(24).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PlanCivil));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(24).CellStyle = styleDate;
|
|
//Civil /Struc.
|
|
if (reportModel.GetRow(rowIndex).GetCell(25) == null) reportModel.GetRow(rowIndex).CreateCell(25);
|
|
if (!string.IsNullOrEmpty(itemOver.CivilStruc))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(25).SetCellValue((DateTime)Convert.ToDateTime(itemOver.CivilStruc));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(25).CellStyle = styleDate;
|
|
//Arch /HVAC
|
|
if (reportModel.GetRow(rowIndex).GetCell(26) == null) reportModel.GetRow(rowIndex).CreateCell(26);
|
|
if (!string.IsNullOrEmpty(itemOver.PlanHVAC))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(26).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PlanHVAC));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(26).CellStyle = styleDate;
|
|
//Arch /HVAC
|
|
if (reportModel.GetRow(rowIndex).GetCell(27) == null) reportModel.GetRow(rowIndex).CreateCell(27);
|
|
if (!string.IsNullOrEmpty(itemOver.ArchHVAC))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(27).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ArchHVAC));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(27).CellStyle = styleDate;
|
|
//ALL
|
|
if (reportModel.GetRow(rowIndex).GetCell(28) == null) reportModel.GetRow(rowIndex).CreateCell(28);
|
|
if (!string.IsNullOrEmpty(itemOver.ALLS))
|
|
{
|
|
reportModel.GetRow(rowIndex).GetCell(28).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ALLS));
|
|
}
|
|
reportModel.GetRow(rowIndex).GetCell(28).CellStyle = styleDate;
|
|
#endregion
|
|
|
|
rowIndex++;
|
|
}
|
|
}
|
|
#endregion
|
|
reportModel.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=P22_Document_Status_IFC_" + Server.UrlEncode(DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"));
|
|
// 添加头信息,指定文件大小,让浏览器能够显示下载进度
|
|
Response.AddHeader("Content-Length", filet.Length.ToString());
|
|
// 指定返回的是一个不能被客户端读取的流,必须被下载
|
|
Response.ContentType = "application/ms-excel";
|
|
// 把文件流发送到客户端
|
|
Response.WriteFile(filet.FullName);
|
|
// 停止页面的执行
|
|
Response.End();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据sql获取数据
|
|
/// </summary>
|
|
/// <param name="strSql"></param>
|
|
/// <param name="tableName"></param>
|
|
/// <param name="parameters"></param>
|
|
/// <returns></returns>
|
|
public static DataTable GetDataTableNameRunText(string strSql, string tableName = "", params SqlParameter[] parameters)
|
|
{
|
|
DataTable dataTable = string.IsNullOrEmpty(tableName) ? new DataTable() : new DataTable(tableName);
|
|
using (SqlConnection Connection = new SqlConnection(Funs.ConnString))
|
|
{
|
|
try
|
|
{
|
|
Connection.Open();
|
|
SqlCommand command = new SqlCommand(strSql, Connection);
|
|
command.CommandType = CommandType.Text;
|
|
if (parameters != null)
|
|
{
|
|
command.Parameters.AddRange(parameters);
|
|
}
|
|
|
|
SqlDataAdapter adapter = new SqlDataAdapter(command);
|
|
adapter.Fill(dataTable);
|
|
}
|
|
finally
|
|
{
|
|
Connection.Close();
|
|
}
|
|
}
|
|
return dataTable;
|
|
}
|
|
#endregion
|
|
|
|
#region 权限设置
|
|
/// <summary>
|
|
/// 菜单按钮权限
|
|
/// </summary>
|
|
private void GetButtonPower()
|
|
{
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.UserId, BLL.Const.DocumentationStatusMCMenuId);
|
|
if (buttonList.Count() > 0)
|
|
{
|
|
if (buttonList.Contains(BLL.Const.BtnOut))
|
|
{
|
|
this.btnExport.Hidden = false;
|
|
this.btnExportIFC.Hidden = false;
|
|
this.btnExportIFC_KPI.Hidden = false;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSearch_Click(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
}
|
|
} |