1082 lines
57 KiB
C#
1082 lines
57 KiB
C#
using BLL;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Data.SqlClient;
|
||
using System.Text;
|
||
using AspNet = System.Web.UI.WebControls;
|
||
using System.Linq;
|
||
using System.IO;
|
||
using NPOI.XSSF.UserModel;
|
||
using NPOI.SS.UserModel;
|
||
using System.Threading;
|
||
using System.Runtime.Serialization;
|
||
|
||
namespace FineUIPro.Web.HJGL.WeldingReport
|
||
{
|
||
public partial class JointComprehensive : PageBase
|
||
{
|
||
|
||
|
||
public static int percent { get; set; }
|
||
public static string url { get; set; }
|
||
#region 加载
|
||
/// <summary>
|
||
/// 加载页面
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
percent = 0;
|
||
url = "";
|
||
Funs.DropDownPageSize(this.ddlPageSize);
|
||
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
||
|
||
//单位
|
||
// var unit = BLL.UnitService.GetUnitByUnitId(this.CurrUser.UnitId);
|
||
// if (unit != null && unit.UnitTypeId == BLL.Const.ProjectUnitType_2)
|
||
if (this.CurrUser.UnitId != Const.UnitId_TCC && this.CurrUser.UserId != Const.hfnbdId)
|
||
{
|
||
//BLL.UnitService.InitSubUnitNameDownList(this.drpUnit, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true);
|
||
//this.drpUnit.SelectedValue = this.CurrUser.UnitId;
|
||
BLL.WorkAreaService.InitWorkAreaProjectUnitDropDownList(this.drpWorkArea, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true);
|
||
}
|
||
else
|
||
{
|
||
var supervisonUnit = BLL.WorkAreaService.IsSupervisor(this.CurrUser.UnitId, this.CurrUser.LoginProjectId);
|
||
if (supervisonUnit)
|
||
{
|
||
BLL.WorkAreaService.InitWorkAreaProjectUnitDropDownList(this.drpWorkArea, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true);
|
||
}
|
||
else
|
||
{
|
||
BLL.WorkAreaService.InitWorkAreaByProjectId(this.drpWorkArea, this.CurrUser.LoginProjectId, true);
|
||
}
|
||
}
|
||
//BindGrid();
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 绑定BindGrid
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
private DataTable tb = null;
|
||
|
||
/// <summary>
|
||
/// 绑定数据
|
||
/// </summary>
|
||
private void BindGrid()
|
||
{
|
||
string strSql = @"SELECT v.*,"
|
||
+ @" ci.CHT_FilmDate as CHT_CheckDate,"
|
||
+ @" c.CHT_CheckCode CHT_CheckCode,c.CHT_CheckID"
|
||
+ @" FROM V_JOINTVIEW v left join CH_CheckItem ci on ci.JOT_ID=v.JOT_ID left join CH_Check c on ci.CHT_CheckID = c.CHT_CheckID WHERE 1=1 ";
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
strSql += " AND v.ProjectId = @ProjectId";
|
||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||
if (this.drpWorkArea.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpWorkArea.SelectedValue))
|
||
{
|
||
strSql += " AND v.WorkAreaId =@workareaId";
|
||
listStr.Add(new SqlParameter("@workareaId", this.drpWorkArea.SelectedValue));
|
||
}
|
||
|
||
if (this.CurrUser.UnitId != Const.UnitId_TCC && this.CurrUser.UserId != Const.hfnbdId)
|
||
{
|
||
strSql += " AND v.UnitId = @UnitId";
|
||
listStr.Add(new SqlParameter("@UnitId", this.CurrUser.UnitId));
|
||
}
|
||
//if (!string.IsNullOrEmpty(this.drpUnit.SelectedValue) && this.drpUnit.SelectedValue != BLL.Const._Null)
|
||
//{
|
||
// strSql += " AND v.UnitId = @UnitId";
|
||
// listStr.Add(new SqlParameter("@UnitId", this.drpUnit.SelectedValue));
|
||
//}
|
||
|
||
if (!string.IsNullOrEmpty(this.txtJointDesc.Text.Trim()))
|
||
{
|
||
strSql += " AND v.JOT_JointDesc LIKE @JOT_JointDesc";
|
||
listStr.Add(new SqlParameter("@JOT_JointDesc", "%" + this.txtJointDesc.Text.Trim() + "%"));
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtIsoNo.Text.Trim()))
|
||
{
|
||
strSql += " AND v.ISO_ISONO LIKE @isoNo";
|
||
listStr.Add(new SqlParameter("@isoNo", "%" + this.txtIsoNo.Text.Trim() + "%"));
|
||
}
|
||
SqlParameter[] parameter = listStr.ToArray();
|
||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||
Random random = new Random();
|
||
foreach(DataRow row in tb.Rows)
|
||
{
|
||
row["JOT_ID"] = row["JOT_ID"].ToString() + row["CH_TrustDate"].ToString()+ random.Next(1,100);
|
||
}
|
||
Grid1.RecordCount = tb.Rows.Count;
|
||
var table = this.GetPagedDataTable(Grid1, tb);
|
||
Grid1.DataSource = table;
|
||
Grid1.DataBind();
|
||
}
|
||
|
||
#region 分页、排序
|
||
/// <summary>
|
||
/// 改变索引事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||
{
|
||
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)
|
||
{
|
||
this.BindGrid();
|
||
}
|
||
#endregion
|
||
#endregion
|
||
|
||
#region 统计按钮事件
|
||
/// <summary>
|
||
/// 统计
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void BtnAnalyse_Click(object sender, EventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 导出按钮
|
||
|
||
|
||
protected void btnOut_Click(object sender, EventArgs e)
|
||
{
|
||
percent = 0;
|
||
url = "";
|
||
string strSql = @"SELECT v.* ,ci.CHT_FilmDate
|
||
FROM V_JOINTVIEW v left join CH_CheckItem ci on ci.JOT_ID=v.JOT_ID left join CH_Check c on ci.CHT_CheckID = c.CHT_CheckID WHERE ";
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
strSql += " v.ProjectId = @ProjectId";
|
||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||
if (this.drpWorkArea.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpWorkArea.SelectedValue))
|
||
{
|
||
strSql += " AND v.WorkAreaId =@workareaId";
|
||
listStr.Add(new SqlParameter("@workareaId", this.drpWorkArea.SelectedValue));
|
||
}
|
||
|
||
if (this.CurrUser.UnitId != Const.UnitId_TCC && this.CurrUser.UserId != Const.hfnbdId)
|
||
{
|
||
strSql += " AND v.UnitId = @UnitId";
|
||
listStr.Add(new SqlParameter("@UnitId", this.CurrUser.UnitId));
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(this.txtJointDesc.Text.Trim()))
|
||
{
|
||
strSql += " AND v.JOT_JointDesc LIKE @JOT_JointDesc";
|
||
listStr.Add(new SqlParameter("@JOT_JointDesc", "%" + this.txtJointDesc.Text.Trim() + "%"));
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtIsoNo.Text.Trim()))
|
||
{
|
||
strSql += " AND v.ISO_ISONO LIKE @isoNo";
|
||
listStr.Add(new SqlParameter("@isoNo", "%" + this.txtIsoNo.Text.Trim() + "%"));
|
||
}
|
||
Thread t = new Thread(new ThreadStart(() => { btnOut(strSql, listStr.ToArray()); }));
|
||
t.Start();
|
||
PageContext.RegisterStartupScript("printX()");
|
||
}
|
||
/// 导出按钮
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnOut(string strSql, SqlParameter[] parameter)
|
||
{
|
||
//Response.ClearContent();
|
||
//string filename = Funs.GetNewFileName();
|
||
//Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("焊口综合信息" + filename, System.Text.Encoding.UTF8) + ".xls");
|
||
//Response.ContentType = "application/excel";
|
||
//Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||
//Response.Write(GetGridTableHtml(Grid1));
|
||
//Response.End();
|
||
|
||
|
||
|
||
|
||
// SqlParameter[] parameter = listStr.ToArray();
|
||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||
|
||
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
|
||
//模板文件
|
||
string TempletFileName = Server.MapPath("~/") + "File/Excel/HJGL_DataOut/焊口综合信息.xlsx";
|
||
//导出文件
|
||
string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
|
||
if (!Directory.Exists(filePath))
|
||
{
|
||
Directory.CreateDirectory(filePath);
|
||
}
|
||
string ReportFileName = filePath + "焊口综合信息" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx";
|
||
|
||
FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
|
||
XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
|
||
|
||
ICellStyle styleCenter = hssfworkbook.CreateCellStyle();
|
||
styleCenter.VerticalAlignment = VerticalAlignment.Center;
|
||
styleCenter.Alignment = HorizontalAlignment.Center;
|
||
styleCenter.BorderLeft = BorderStyle.Thin;
|
||
styleCenter.BorderTop = BorderStyle.Thin;
|
||
styleCenter.BorderRight = BorderStyle.Thin;
|
||
styleCenter.BorderBottom = BorderStyle.Thin;
|
||
styleCenter.WrapText = true;
|
||
IFont font = styleCenter.GetFont(hssfworkbook);
|
||
font.Color = 10;//颜色
|
||
font.FontHeightInPoints = 10;//字体高度(与excel中的字号一致)
|
||
styleCenter.SetFont(font);
|
||
XSSFSheet recordSheet = (XSSFSheet)hssfworkbook.GetSheet("焊口综合信息");
|
||
|
||
// recordSheet.AddMergedRegion(new CellRangeAddress(0, 0, 8, 9));
|
||
|
||
|
||
|
||
|
||
for (int i = 1; i <= tb.Rows.Count; i++)
|
||
{
|
||
try
|
||
{
|
||
var row = recordSheet.CreateRow(i);
|
||
row.CreateCell(0).SetCellValue("" + i);
|
||
row.CreateCell(1).SetCellValue(tb.Rows[i]["WorkAreaCode"] != DBNull.Value ? tb.Rows[i]["WorkAreaCode"].ToString() : "");
|
||
row.CreateCell(2).SetCellValue(tb.Rows[i]["ISO_ISONO"] != DBNull.Value ? tb.Rows[i]["ISO_ISONO"].ToString() : "");
|
||
row.CreateCell(3).SetCellValue(tb.Rows[i]["JOT_BelongPipe"] != DBNull.Value ? tb.Rows[i]["JOT_BelongPipe"].ToString() : "");
|
||
row.CreateCell(4).SetCellValue(tb.Rows[i]["JOT_JointNo"] != DBNull.Value ? tb.Rows[i]["JOT_JointNo"].ToString() : "");
|
||
try {
|
||
row.CreateCell(5).SetCellValue(tb.Rows[i]["JOT_Dia"] != DBNull.Value ? ((decimal)tb.Rows[i]["JOT_Dia"]).ToString("##.#") : "");
|
||
}
|
||
catch (Exception e) { }
|
||
row.CreateCell(6).SetCellValue(tb.Rows[i]["JOT_Sch"] != DBNull.Value ? tb.Rows[i]["JOT_Sch"].ToString() : "");
|
||
row.CreateCell(7).SetCellValue(tb.Rows[i]["JOT_FactSch"] != DBNull.Value ? tb.Rows[i]["JOT_FactSch"].ToString() : "");
|
||
row.CreateCell(8).SetCellValue(tb.Rows[i]["STE_Name1"] != DBNull.Value ? tb.Rows[i]["STE_Name1"].ToString() : "");
|
||
row.CreateCell(9).SetCellValue(tb.Rows[i]["JOT_CellWelder"] != DBNull.Value ? tb.Rows[i]["JOT_CellWelder"].ToString() : "");
|
||
row.CreateCell(10).SetCellValue(tb.Rows[i]["JOT_FloorWelder"] != DBNull.Value ? tb.Rows[i]["JOT_FloorWelder"].ToString() : "");
|
||
row.CreateCell(11).SetCellValue(tb.Rows[i]["WeldingMethodName"] != DBNull.Value ? tb.Rows[i]["WeldingMethodName"].ToString() : "");
|
||
row.CreateCell(12).SetCellValue(tb.Rows[i]["DetectionRate"] != DBNull.Value ? tb.Rows[i]["DetectionRate"].ToString() : "");
|
||
row.CreateCell(13).SetCellValue(tb.Rows[i]["SER_NAME"] != DBNull.Value ? tb.Rows[i]["SER_NAME"].ToString() : "");
|
||
try
|
||
{
|
||
row.CreateCell(14).SetCellValue(tb.Rows[i]["JOT_WeldDate"] != DBNull.Value ? ((DateTime)tb.Rows[i]["JOT_WeldDate"]).ToString("yyyy-MM-dd") : "");
|
||
}
|
||
catch (Exception e) { }
|
||
row.CreateCell(15).SetCellValue(tb.Rows[i]["JOT_DailyReportNo"] != DBNull.Value ? tb.Rows[i]["JOT_DailyReportNo"].ToString() : "");
|
||
row.CreateCell(16).SetCellValue(tb.Rows[i]["CH_TRUSTCODE1"] != DBNull.Value ? tb.Rows[i]["CH_TRUSTCODE1"].ToString() : "");
|
||
row.CreateCell(17).SetCellValue(tb.Rows[i]["ProessName"] != DBNull.Value ? tb.Rows[i]["ProessName"].ToString() : "");
|
||
row.CreateCell(18).SetCellValue(tb.Rows[i]["JOT_HotRpt"] != DBNull.Value ? tb.Rows[i]["JOT_HotRpt"].ToString() : "");
|
||
try
|
||
{
|
||
row.CreateCell(19).SetCellValue(tb.Rows[i]["ProessDate"] != DBNull.Value ? ((DateTime)tb.Rows[i]["ProessDate"]).ToString("yyyy-MM-dd") : "");
|
||
}
|
||
catch (Exception e) { }
|
||
try
|
||
{
|
||
row.CreateCell(20).SetCellValue(tb.Rows[i]["CHT_CHECKDATE"] != DBNull.Value ? ((DateTime)tb.Rows[i]["CHT_FilmDate"]).ToString("yyyy-MM-dd") : "");
|
||
}
|
||
catch (Exception e) { }
|
||
row.CreateCell(21).SetCellValue(tb.Rows[i]["JOT_Size"] != DBNull.Value ? tb.Rows[i]["JOT_Size"].ToString() : "");
|
||
row.CreateCell(22).SetCellValue(tb.Rows[i]["WMT_MatCode"] != DBNull.Value ? tb.Rows[i]["WMT_MatCode"].ToString() : "");
|
||
row.CreateCell(23).SetCellValue(tb.Rows[i]["WMT_Matname"] != DBNull.Value ? tb.Rows[i]["WMT_Matname"].ToString() : "");
|
||
row.CreateCell(24).SetCellValue(tb.Rows[i]["HsCode"] != DBNull.Value ? tb.Rows[i]["HsCode"].ToString() : "");
|
||
row.CreateCell(25).SetCellValue(tb.Rows[i]["Hsname"] != DBNull.Value ? tb.Rows[i]["Hsname"].ToString() : "");
|
||
row.CreateCell(26).SetCellValue(tb.Rows[i]["JOT_JointDesc"] != DBNull.Value ? tb.Rows[i]["JOT_JointDesc"].ToString() : "");
|
||
row.CreateCell(27).SetCellValue(tb.Rows[i]["If_dkName"] != DBNull.Value ? tb.Rows[i]["If_dkName"].ToString() : "");
|
||
row.CreateCell(28).SetCellValue(tb.Rows[i]["HotHardCode"] != DBNull.Value ? tb.Rows[i]["HotHardCode"].ToString() : "");
|
||
try
|
||
{
|
||
row.CreateCell(29).SetCellValue(tb.Rows[i]["HotHardDate"] != DBNull.Value ? ((DateTime)tb.Rows[i]["HotHardDate"]).ToString("yyyy-MM-dd") : "");
|
||
}
|
||
catch (Exception e) { }
|
||
try
|
||
{
|
||
row.CreateCell(30).SetCellValue(tb.Rows[i]["CH_TrustDate"] != DBNull.Value ? ((DateTime)tb.Rows[i]["CH_TrustDate"]).ToString("yyyy-MM-dd") : "");
|
||
}
|
||
catch (Exception e) { }
|
||
row.CreateCell(31).SetCellValue(tb.Rows[i]["PTP_TestPackageNo"] != DBNull.Value ? tb.Rows[i]["PTP_TestPackageNo"].ToString() : "");
|
||
row.CreateCell(32).SetCellValue(tb.Rows[i]["WeldTypeCode"] != DBNull.Value ? tb.Rows[i]["WeldTypeCode"].ToString() : "");
|
||
|
||
|
||
if ((int)(90 * i / tb.Rows.Count) > percent)
|
||
{
|
||
percent = (int)(90 * i / tb.Rows.Count);
|
||
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
|
||
}
|
||
|
||
}
|
||
|
||
using (FileStream filess = File.OpenWrite(ReportFileName))
|
||
{
|
||
hssfworkbook.Write(filess);
|
||
hssfworkbook.Close();
|
||
filess.Flush();
|
||
filess.Close();
|
||
}
|
||
//PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReportId, isoId, varValue, this.CurrUser.LoginProjectId)));
|
||
percent = 100;
|
||
url = ReportFileName.Replace(Server.MapPath("~/"), "");
|
||
//
|
||
//Response.Clear();
|
||
//Response.Charset = "GB2312";
|
||
//Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||
//// 添加头信息,为"文件下载/另存为"对话框指定默认文件名
|
||
//Response.AddHeader("Content-Disposition", "attachment; filename=焊口综合信息_" + 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();
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
[System.Web.Services.WebMethod]
|
||
public static int getPercent()
|
||
{
|
||
return percent;
|
||
}
|
||
|
||
[System.Web.Services.WebMethod]
|
||
public static string getUrl()
|
||
{
|
||
return url;
|
||
}
|
||
/// <summary>
|
||
/// 导出方法
|
||
/// </summary>
|
||
/// <param name="grid"></param>
|
||
/// <returns></returns>
|
||
private string GetGridTableHtml(Grid grid)
|
||
{
|
||
StringBuilder sb = new StringBuilder();
|
||
grid.PageSize = this.Grid1.RecordCount;
|
||
BindGrid();
|
||
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
|
||
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
|
||
sb.Append("<tr>");
|
||
foreach (GridColumn column in grid.Columns)
|
||
{
|
||
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
|
||
}
|
||
sb.Append("</tr>");
|
||
foreach (GridRow row in grid.Rows)
|
||
{
|
||
sb.Append("<tr>");
|
||
foreach (GridColumn column in grid.Columns)
|
||
{
|
||
string html = row.Values[column.ColumnIndex].ToString();
|
||
if (column.ColumnID == "tfNumber")
|
||
{
|
||
html = (row.FindControl("labNumber") as AspNet.Label).Text;
|
||
}
|
||
sb.AppendFormat("<td style=\"vnd.ms-excel.numberformat:@\" >{0}</td>", html);
|
||
}
|
||
|
||
sb.Append("</tr>");
|
||
}
|
||
var sumary = grid.SummaryData;
|
||
if (sumary != null)
|
||
{
|
||
foreach (GridColumn column in grid.Columns)
|
||
{
|
||
try
|
||
{
|
||
if (sumary.ContainsKey(column.ColumnID))
|
||
{
|
||
sb.AppendFormat("<td style=\"vnd.ms-excel.numberformat:@\" >{0}</td>", sumary.GetValue(column.ColumnID).ToString());
|
||
}
|
||
else
|
||
{
|
||
sb.AppendFormat("<td style=\"vnd.ms-excel.numberformat:@\" >{0}</td>", "");
|
||
}
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
sb.AppendFormat("<td style=\"vnd.ms-excel.numberformat:@\" >{0}</td>", "");
|
||
|
||
}
|
||
|
||
}
|
||
}
|
||
sb.Append("</table>");
|
||
|
||
return sb.ToString();
|
||
}
|
||
#endregion
|
||
|
||
#region DropDownList下拉
|
||
/// <summary>
|
||
/// 单位下拉选择事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
//this.drpWorkArea.Items.Clear();
|
||
//if (this.drpUnit.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpUnit.SelectedValue))
|
||
//{
|
||
// BLL.WorkAreaService.InitWorkAreaProjectUnitDropDownList(this.drpWorkArea, this.CurrUser.LoginProjectId, this.drpUnit.SelectedValue, true);
|
||
// this.drpWorkArea.SelectedIndex = 0;
|
||
//}
|
||
}
|
||
#endregion
|
||
|
||
#region 报表打印
|
||
/// <summary>
|
||
/// 报表打印
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnPrint_Click(object sender, EventArgs e)
|
||
{
|
||
//string isoId = this.tvControlItem.SelectedNodeID;
|
||
//var q = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(isoId);
|
||
|
||
//if (q != null)
|
||
//{
|
||
if (this.drpWorkArea.SelectedValue != BLL.Const._Null && this.drpWorkArea.SelectedValue != "")
|
||
{
|
||
if (printType.SelectedValue == "0") //焊接工作记录
|
||
{
|
||
BLL.Common.FastReportService.ResetData();
|
||
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||
var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(this.drpWorkArea.SelectedValue);
|
||
keyValuePairs.Add("WorkAreaName", workArea.WorkAreaName);
|
||
keyValuePairs.Add("ProjectName", ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId));
|
||
BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
|
||
|
||
string strSql = @"SELECT v.*,"
|
||
+ @" ci.CHT_FilmDate as CHT_CheckDate,"
|
||
+ @" c.CHT_CheckCode CHT_CheckCode,c.CHT_CheckID"
|
||
+ @" FROM V_JOINTVIEW v left join CH_CheckItem ci on ci.JOT_ID=v.JOT_ID left join CH_Check c on ci.CHT_CheckID = c.CHT_CheckID WHERE 1=1 ";
|
||
List<SqlParameter> listStr = new List<SqlParameter>
|
||
{
|
||
new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
|
||
};
|
||
if (this.drpWorkArea.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpWorkArea.SelectedValue))
|
||
{
|
||
strSql += " AND v.WorkAreaId =@workareaId";
|
||
listStr.Add(new SqlParameter("@workareaId", this.drpWorkArea.SelectedValue));
|
||
}
|
||
|
||
if (this.CurrUser.UnitId != Const.UnitId_TCC && this.CurrUser.UserId != Const.hfnbdId)
|
||
{
|
||
strSql += " AND v.UnitId = @UnitId";
|
||
listStr.Add(new SqlParameter("@UnitId", this.CurrUser.UnitId));
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtJointDesc.Text.Trim()))
|
||
{
|
||
strSql += " AND v.JOT_JointDesc LIKE @JOT_JointDesc";
|
||
listStr.Add(new SqlParameter("@JOT_JointDesc", "%" + this.txtJointDesc.Text.Trim() + "%"));
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtIsoNo.Text.Trim()))
|
||
{
|
||
strSql += " AND v.ISO_ISONO LIKE @isoNo";
|
||
listStr.Add(new SqlParameter("@isoNo", "%" + this.txtIsoNo.Text.Trim() + "%"));
|
||
}
|
||
SqlParameter[] parameter = listStr.ToArray();
|
||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||
DataView dv = tb.DefaultView;//获取表视图
|
||
dv.Sort = "WorkAreaCode,ISO_ISONO,JOT_JointNo ASC";
|
||
tb = dv.ToTable();//转为表
|
||
if (tb != null)
|
||
{
|
||
DataTable dt = new DataTable();
|
||
dt.TableName = "Table1";
|
||
dt.Columns.Add("ISO_IsoNo");
|
||
dt.Columns.Add("JOT_JointNo");
|
||
dt.Columns.Add("WED_Code2");
|
||
dt.Columns.Add("JOT_JointDesc");
|
||
dt.Columns.Add("STE_Name1");
|
||
dt.Columns.Add("JOT_Location");
|
||
dt.Columns.Add("WeldingMethodName");
|
||
dt.Columns.Add("WeldMat");
|
||
dt.Columns.Add("JOT_PrepareTemp");
|
||
dt.Columns.Add("JOT_WeldDate");
|
||
|
||
DataRow[] rows = tb.DefaultView.ToTable().Select();
|
||
foreach (var row in rows)
|
||
{
|
||
var newRow = dt.NewRow();
|
||
newRow["ISO_IsoNo"] = row["ISO_ISONO"].ToString();
|
||
newRow["JOT_JointNo"] = row["JOT_JointNo"].ToString();
|
||
newRow["WED_Code2"] = row["JOT_FloorWelder"].ToString();
|
||
newRow["JOT_JointDesc"] = row["JOT_JointDesc"].ToString();
|
||
newRow["STE_Name1"] = row["STE_Name1"].ToString();
|
||
newRow["JOT_Location"] = row["JOT_Location"].ToString();
|
||
newRow["WeldingMethodName"] = row["WeldingMethodName"].ToString();
|
||
newRow["WeldMat"] = row["WMT_Matname"].ToString();
|
||
newRow["JOT_PrepareTemp"] = row["JOT_PrepareTemp"].ToString();
|
||
newRow["JOT_WeldDate"] = string.Format("{0:yyyy-MM-dd}", row["JOT_WeldDate"]);
|
||
dt.Rows.Add(newRow);
|
||
}
|
||
BLL.Common.FastReportService.AddFastreportTable(dt);
|
||
}
|
||
|
||
|
||
string initTemplatePath = "";
|
||
string rootPath = Server.MapPath("~/");
|
||
|
||
initTemplatePath = "File\\Fastreport\\管道焊接工作记录.frx";
|
||
|
||
if (File.Exists(rootPath + initTemplatePath))
|
||
{
|
||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../TrustManage/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
||
|
||
|
||
}
|
||
|
||
|
||
}
|
||
//else if (printType.SelectedValue == "1")// 焊接工艺评定
|
||
//{
|
||
// var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(q.WorkAreaId);
|
||
// var install = BLL.Project_InstallationService.GetInstallationByInstallationId(workArea.InstallationId);
|
||
// Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||
// keyValuePairs.Add("ISO_IsoNo", q.ISO_IsoNo);
|
||
// keyValuePairs.Add("install", install.InstallationName);
|
||
// keyValuePairs.Add("workarea", workArea.WorkAreaName);
|
||
// BLL.Common.FastReportService.ResetData();
|
||
// BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
|
||
|
||
|
||
// string strSql = @"SELECT '' WED_Code,jointInfo.JOT_ID,
|
||
// jointInfo.ProjectId,
|
||
// jointInfo.JOT_JointNo,
|
||
// jointInfo.is_hj,
|
||
// jointInfo.JointStatusName,
|
||
// jointInfo.JOT_TrustFlagName,
|
||
// jointInfo.JOT_CheckFlagName,
|
||
// jointInfo.ISO_ID,
|
||
// jointInfo.ISO_IsoNo,
|
||
// jointInfo.ISO_IsoNumber,
|
||
// jointInfo.WorkAreaId,
|
||
// jointInfo.WorkAreaCode,
|
||
// jointInfo.JOT_WeldDate,
|
||
// jointInfo.JOT_DailyReportNo,
|
||
// jointInfo.STE_Name1,
|
||
// jointInfo.STE_Name2,
|
||
// jointInfo.Component1,
|
||
// jointInfo.Component2,
|
||
// jointInfo.WED_Code1,
|
||
// jointInfo.WED_Name1,
|
||
// jointInfo.WED_Code2,
|
||
// jointInfo.WED_Name2,
|
||
// jointInfo.JOT_JointDesc,
|
||
// jointInfo.JOT_Dia,
|
||
// jointInfo.JOT_Size,
|
||
// jointInfo.JOT_Sch,
|
||
// jointInfo.JOT_FactSch,
|
||
// jointInfo.GrooveTypeName,
|
||
// jointInfo.JOTY_ID,
|
||
// jointInfo.WeldTypeName,
|
||
// jointInfo.WME_ID,
|
||
// jointInfo.WeldingMethodName,
|
||
// jointInfo.WeldSilk,
|
||
// jointInfo.WeldMat,
|
||
// jointInfo.WLO_Code,
|
||
// jointInfo.WeldingLocationName,
|
||
// jointInfo.JOT_DoneDin,
|
||
// jointInfo.JOT_PrepareTemp,
|
||
// jointInfo.JOT_JointAttribute,
|
||
// jointInfo.JOT_CellTemp,
|
||
// jointInfo.JOT_LastTemp,
|
||
// jointInfo.JOT_HeartNo1,
|
||
// jointInfo.JOT_HeartNo2,
|
||
// jointInfo.PointDate,
|
||
// jointInfo.PointNo,
|
||
// jointInfo.CH_TrustCode,
|
||
// jointInfo.CH_TrustDate,
|
||
// jointInfo.JOT_FaceCheckResult,
|
||
// jointInfo.JOT_FaceCheckDate,
|
||
// jointInfo.JOT_FaceChecker,
|
||
// jointInfo.IS_Proess,
|
||
// jointInfo.JOT_BelongPipe,
|
||
// jointInfo.JOT_Electricity,
|
||
// jointInfo.JOT_Voltage,
|
||
// jointInfo.JOT_ProessDate,
|
||
// jointInfo.JOT_HotRpt,
|
||
// jointInfo.JOT_Remark,jointInfo.JOT_Location"
|
||
// + @" from View_JointInfo as jointInfo "
|
||
// + @" WHERE jointInfo.ProjectId= @projectId AND jointInfo.ISO_ID=@isoId ";
|
||
// List<SqlParameter> listStr = new List<SqlParameter>
|
||
//{
|
||
// new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
|
||
// new SqlParameter("@isoId", this.tvControlItem.SelectedNodeID),
|
||
//};
|
||
// if (!string.IsNullOrEmpty(this.txtJOT_JointNo.Text.Trim()))
|
||
// {
|
||
// strSql += " AND jointInfo.JOT_JointNo LIKE @JOT_JointNo";
|
||
// listStr.Add(new SqlParameter("@JOT_JointNo", "%" + this.txtJOT_JointNo.Text.Trim() + "%"));
|
||
// }
|
||
// if (!string.IsNullOrEmpty(this.dpIsHj.SelectedValue))
|
||
// {
|
||
// strSql += " AND jointInfo.is_hj = @is_hj";
|
||
// listStr.Add(new SqlParameter("@is_hj", this.dpIsHj.SelectedValue));
|
||
// }
|
||
// strSql += " order by JOT_JointNo ";
|
||
// SqlParameter[] parameter = listStr.ToArray();
|
||
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||
// //if (tb.Rows.Count > 27)
|
||
// //{
|
||
// // // for (int i = 0; i < (tb.Rows.Count - 24) % 30; i++)
|
||
// // for (int j = 0; j < tb.Rows.Count - 27; j++)
|
||
// // {
|
||
// // recordSheet.GetRow(6).CopyRowTo(7 + j);
|
||
// // }
|
||
// //}
|
||
|
||
// //if (tb.Rows.Count > 12)
|
||
// //{
|
||
// // recordSheet.ShiftRows(7, 34, tb.Rows.Count - 12);
|
||
// // for (int j = 0; j < tb.Rows.Count - 12; j++)
|
||
// // {
|
||
// // recordSheet.CopyRow(6 + j, 7 + j);
|
||
// // }
|
||
// //}
|
||
// for (int i = 0; i < tb.Rows.Count; i++)
|
||
// {
|
||
// try
|
||
// {
|
||
// string WED_Code = "";
|
||
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Code1"].ToString()))
|
||
// WED_Code += tb.Rows[i]["WED_Code1"].ToString();
|
||
|
||
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Code2"].ToString()))
|
||
// WED_Code += " " + tb.Rows[i]["WED_Code2"].ToString();
|
||
// tb.Rows[i]["WED_Code"] = WED_Code;
|
||
// //recordSheet.GetRow(5 + i).GetCell(0).SetCellValue(tb.Rows[i]["ISO_IsoNo"].ToString());
|
||
// //recordSheet.GetRow(5 + i).GetCell(1).SetCellValue("");
|
||
// //recordSheet.GetRow(5 + i).GetCell(2).SetCellValue(tb.Rows[i]["JOT_JointNo"].ToString());
|
||
// //recordSheet.GetRow(5 + i).GetCell(4).SetCellValue(WED_Code);
|
||
// //recordSheet.GetRow(5 + i).GetCell(5).SetCellValue("");
|
||
// //recordSheet.GetRow(5 + i).GetCell(6).SetCellValue("");
|
||
// //recordSheet.GetRow(5 + i).GetCell(7).SetCellValue("");
|
||
// //recordSheet.GetRow(5 + i).GetCell(8).SetCellValue(tb.Rows[i]["WeldingMethodName"].ToString());
|
||
// //recordSheet.GetRow(5 + i).GetCell(9).SetCellValue(tb.Rows[i]["JOT_Electricity"].ToString());
|
||
// //recordSheet.GetRow(5 + i).GetCell(10).SetCellValue(tb.Rows[i]["JOT_Voltage"].ToString());
|
||
// //recordSheet.GetRow(5 + i).GetCell(11).SetCellValue("");
|
||
// //recordSheet.GetRow(5 + i).GetCell(13).SetCellValue(tb.Rows[i]["JOT_PrepareTemp"].ToString());
|
||
// //recordSheet.GetRow(5 + i).GetCell(14).SetCellValue(tb.Rows[i]["JOT_CellTemp"].ToString());
|
||
// //recordSheet.GetRow(5 + i).GetCell(15).SetCellValue(tb.Rows[i]["JOT_LastTemp"].ToString());
|
||
// //if (!string.IsNullOrEmpty(tb.Rows[i]["JOT_FaceCheckDate"].ToString()))
|
||
// //{
|
||
// // DateTimeFormat dateTimeFormat = new DateTimeFormat("yyyy-MM-DD HH:mm:ss.000");
|
||
// // DateTime dateTime = DateTime.Parse(tb.Rows[i]["JOT_FaceCheckDate"].ToString());
|
||
|
||
// // recordSheet.GetRow(5 + i).GetCell(16).SetCellValue(dateTime.ToShortDateString());
|
||
// //}
|
||
// }
|
||
// catch (Exception)
|
||
// {
|
||
|
||
// }
|
||
|
||
// }
|
||
// tb.TableName = "Table1";
|
||
// BLL.Common.FastReportService.AddFastreportTable(tb);
|
||
|
||
// string initTemplatePath = "";
|
||
// string rootPath = Server.MapPath("~/");
|
||
|
||
// initTemplatePath = "File\\Fastreport\\管道焊接工艺检查记录.frx";
|
||
|
||
// if (File.Exists(rootPath + initTemplatePath))
|
||
// {
|
||
// PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../TrustManage/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
||
|
||
// }
|
||
//}
|
||
|
||
//else if (printType.SelectedValue == "2")// 焊接工艺评定
|
||
//{
|
||
// Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||
// keyValuePairs.Add("ISO_IsoNo", q.ISO_IsoNo);
|
||
// var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(q.WorkAreaId);
|
||
// var install = BLL.Project_InstallationService.GetInstallationByInstallationId(workArea.InstallationId);
|
||
// var project = BLL.ProjectService.GetProjectByProjectId(q.ProjectId);
|
||
// keyValuePairs.Add("ProjecctName", project.ProjectName);//工程名称
|
||
// keyValuePairs.Add("InstallationName", install.InstallationName);
|
||
// keyValuePairs.Add("WorkAreaName", workArea.WorkAreaName);//单位工程名称
|
||
// keyValuePairs.Add("ISOName", q.ISO_IsoNumber);//设备名称
|
||
// keyValuePairs.Add("ISO_Specification", q.ISO_Specification);//设备规格
|
||
// var material = Base_MaterialService.GetMaterialByMaterialId(q.MaterialId);
|
||
// keyValuePairs.Add("MaterialCode", material.MaterialCode);//设备材质
|
||
|
||
// String strSql1 = @"SELECT '' WED_Code, jointInfo.JOT_JointNo,--焊缝位置/焊缝编号
|
||
// '' WED_Name,--焊工姓名 或钢印号
|
||
// jointInfo.JOT_JointDesc,--焊缝规格mm
|
||
// jointInfo.JOT_PrepareTemp, --预热温度 ℃
|
||
// jointInfo.JOT_Electricity, --焊接电流 A
|
||
// jointInfo.JOT_Voltage, --焊接电压 V
|
||
// jointInfo.JOT_ID,
|
||
// jointInfo.ProjectId,
|
||
// jointInfo.JOT_WeldDate, -- 焊接日期
|
||
// jointInfo.WeldingMethodName,
|
||
// jointInfo.WeldSilk,
|
||
// WED_Name1,WED_Name2,WED_Code1,WED_Code2
|
||
// from View_JointInfo as jointInfo WHERE jointInfo.ProjectId= @projectId AND jointInfo.ISO_ID=@isoId ";
|
||
|
||
|
||
// List<SqlParameter> listStr1 = new List<SqlParameter>
|
||
//{
|
||
// new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
|
||
// new SqlParameter("@isoId", this.tvControlItem.SelectedNodeID),
|
||
//};
|
||
// if (!string.IsNullOrEmpty(this.txtJOT_JointNo.Text.Trim()))
|
||
// {
|
||
// strSql1 += " AND jointInfo.JOT_JointNo LIKE @JOT_JointNo";
|
||
// listStr1.Add(new SqlParameter("@JOT_JointNo", "%" + this.txtJOT_JointNo.Text.Trim() + "%"));
|
||
// }
|
||
// if (!string.IsNullOrEmpty(this.dpIsHj.SelectedValue))
|
||
// {
|
||
// strSql1 += " AND jointInfo.is_hj = @is_hj";
|
||
// listStr1.Add(new SqlParameter("@is_hj", this.dpIsHj.SelectedValue));
|
||
// }
|
||
// strSql1 += " order by JOT_JointNo ";
|
||
|
||
// SqlParameter[] parameter1 = listStr1.ToArray();
|
||
// DataTable tb = SQLHelper.GetDataTableRunText(strSql1, parameter1);
|
||
// if (tb.Rows.Count > 0)
|
||
// {
|
||
|
||
// keyValuePairs.Add("WeldingMethodName", tb.Rows[0]["WeldingMethodName"].ToString());//焊接方法
|
||
// keyValuePairs.Add("WeldSilk", tb.Rows[0]["WeldSilk"].ToString());//焊接材料
|
||
// }
|
||
// for (int i = 0; i < tb.Rows.Count; i++)
|
||
// {
|
||
// try
|
||
// {
|
||
// string WED_Name = "";
|
||
// string WED_Code = "";
|
||
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Name1"].ToString()))
|
||
// {
|
||
// WED_Name += tb.Rows[i]["WED_Name1"].ToString();
|
||
// WED_Code += tb.Rows[i]["WED_Code1"].ToString();
|
||
|
||
// }
|
||
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Name2"].ToString()))
|
||
// {
|
||
// WED_Name += "," + tb.Rows[i]["WED_Name2"].ToString();
|
||
// WED_Code += "," + tb.Rows[i]["WED_Code2"].ToString();
|
||
|
||
// }
|
||
// tb.Rows[i]["WED_Name"] = WED_Name;
|
||
// tb.Rows[i]["WED_Code"] = WED_Code;
|
||
// }
|
||
// catch (Exception)
|
||
// {
|
||
|
||
// }
|
||
// }
|
||
// BLL.Common.FastReportService.ResetData();
|
||
// BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
|
||
|
||
// tb.TableName = "Table1";
|
||
// BLL.Common.FastReportService.AddFastreportTable(tb);
|
||
|
||
// string initTemplatePath = "";
|
||
// string rootPath = Server.MapPath("~/");
|
||
|
||
// initTemplatePath = "File\\Fastreport\\设备焊接工作记录.frx";
|
||
|
||
// if (File.Exists(rootPath + initTemplatePath))
|
||
// {
|
||
// PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../TrustManage/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
||
|
||
// }
|
||
|
||
|
||
//}
|
||
|
||
//else if (printType.SelectedValue == "3")
|
||
//{
|
||
|
||
// string varValue = string.Empty;
|
||
// var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||
// var workarea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(q.WorkAreaId);
|
||
// var installationName = BLL.Project_InstallationService.GetInstallationByInstallationId(workarea.InstallationId).InstallationName;
|
||
// var unitName = BLL.UnitService.GetUnitNameByUnitId(q.UnitId);
|
||
// string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
|
||
// //模板文件
|
||
// string TempletFileName = Server.MapPath("~/") + "File/Excel/HJGL_DataOut/管道焊接接头报检检查记录.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);
|
||
|
||
// ICellStyle styleCenter = hssfworkbook.CreateCellStyle();
|
||
// styleCenter.VerticalAlignment = VerticalAlignment.Center;
|
||
// styleCenter.Alignment = HorizontalAlignment.Center;
|
||
// styleCenter.BorderLeft = BorderStyle.Thin;
|
||
// styleCenter.BorderTop = BorderStyle.Thin;
|
||
// styleCenter.BorderRight = BorderStyle.Thin;
|
||
// styleCenter.BorderBottom = BorderStyle.Thin;
|
||
// styleCenter.WrapText = true;
|
||
// IFont font = styleCenter.GetFont(hssfworkbook);
|
||
// // font.Color = 10;//颜色
|
||
// font.FontHeightInPoints = 10;//字体高度(与excel中的字号一致)
|
||
// styleCenter.SetFont(font);
|
||
// XSSFSheet recordSheet = (XSSFSheet)hssfworkbook.GetSheet("管道焊接接头报检检查记录");
|
||
|
||
// // recordSheet.AddMergedRegion(new CellRangeAddress(0, 0, 8, 9));
|
||
// var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(q.WorkAreaId);
|
||
|
||
|
||
// //recordSheet.GetRow(0).CreateCell(14).SetCellValue(projectName.ToString());
|
||
// recordSheet.GetRow(0).CreateCell(14).SetCellValue(installationName);
|
||
// recordSheet.GetRow(0).GetCell(14).CellStyle = styleCenter;
|
||
// recordSheet.GetRow(2).CreateCell(14).SetCellValue(workarea.WorkAreaName);
|
||
// recordSheet.GetRow(2).GetCell(14).CellStyle = styleCenter;
|
||
// recordSheet.GetRow(2).CreateCell(1).SetCellValue(unitName);
|
||
// recordSheet.GetRow(2).GetCell(1).CellStyle = styleCenter;
|
||
// recordSheet.GetRow(3).GetCell(8).CellStyle = styleCenter;
|
||
// //recordSheet.GetRow(2).CreateCell(7).SetCellValue(q.CHT_CheckCode);
|
||
// recordSheet.GetRow(2).GetCell(7).CellStyle = styleCenter;
|
||
// int i = 0;
|
||
// List<Model.View_JointInfo> items = Funs.DB.View_JointInfo.Where(x => x.ISO_ID == q.ISO_ID).ToList();
|
||
// var ndtt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(items[0].DetectionTypeId);
|
||
// if (ndtt != null)
|
||
// {
|
||
// recordSheet.GetRow(3).CreateCell(8).SetCellValue(ndtt.DetectionTypeCode);
|
||
|
||
// }
|
||
// recordSheet.GetRow(3).CreateCell(14).SetCellValue(items.Count + "个");
|
||
// recordSheet.GetRow(3).GetCell(14).CellStyle = styleCenter;
|
||
// if (items.Count > 11)
|
||
// {
|
||
// recordSheet.ShiftRows(17, 19, items.Count - 11);
|
||
// for (int j = 0; j < items.Count - 11; j++)
|
||
// {
|
||
// recordSheet.CopyRow(16 + j, 17 + j);
|
||
// }
|
||
// recordSheet.GetRow(items.Count + 7).Height = recordSheet.GetRow(items.Count + 5).Height;
|
||
// recordSheet.GetRow(items.Count + 6).Height = recordSheet.GetRow(items.Count + 5).Height;
|
||
|
||
// }
|
||
|
||
// foreach (var t in items)
|
||
// {
|
||
|
||
|
||
// if (q != null)
|
||
// {
|
||
// var dDetectionRate = Funs.DB.Base_DetectionRate.FirstOrDefault(x => x.DetectionRateId == q.DetectionRateId);
|
||
// if (dDetectionRate != null)
|
||
// {
|
||
// recordSheet.GetRow(3).CreateCell(18).SetCellValue(dDetectionRate.DetectionRateValue + "%");
|
||
// recordSheet.GetRow(3).GetCell(18).CellStyle = styleCenter;
|
||
// }
|
||
// }
|
||
|
||
|
||
// recordSheet.GetRow(i + 6).CreateCell(0).SetCellValue((i + 1) + "");
|
||
// recordSheet.GetRow(i + 6).GetCell(0).CellStyle = styleCenter;
|
||
// recordSheet.GetRow(i + 6).CreateCell(1).SetCellValue(q.ISO_IsoNo);
|
||
// recordSheet.GetRow(i + 6).GetCell(1).CellStyle = styleCenter;
|
||
// recordSheet.GetRow(i + 6).CreateCell(3).SetCellValue(t.JOT_JointNo);
|
||
// recordSheet.GetRow(i + 6).GetCell(3).CellStyle = styleCenter;
|
||
// string welderCode = t.WED_Code1;
|
||
// if (!string.IsNullOrEmpty(t.WED_Code2))
|
||
// {
|
||
// if (!string.IsNullOrEmpty(welderCode))
|
||
// {
|
||
// if (welderCode != t.WED_Code2)
|
||
// {
|
||
// welderCode += "," + t.WED_Code2;
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// welderCode = t.WED_Code2;
|
||
// }
|
||
// }
|
||
// recordSheet.GetRow(i + 6).CreateCell(4).SetCellValue(welderCode);
|
||
// recordSheet.GetRow(i + 6).GetCell(4).CellStyle = styleCenter;
|
||
// #region 查找委托中的检测类型并赋给检测类型变量
|
||
|
||
|
||
|
||
// recordSheet.GetRow(i + 6).CreateCell(6).SetCellValue(t.JOT_JointDesc);
|
||
// recordSheet.GetRow(i + 6).GetCell(6).CellStyle = styleCenter;
|
||
// recordSheet.GetRow(i + 6).CreateCell(7).SetCellValue(t.STE_Name1);
|
||
// recordSheet.GetRow(i + 6).GetCell(7).CellStyle = styleCenter;
|
||
|
||
// recordSheet.GetRow(i + 6).CreateCell(10).SetCellValue(t.JOT_Location);
|
||
// recordSheet.GetRow(i + 6).GetCell(10).CellStyle = styleCenter;
|
||
|
||
// recordSheet.GetRow(i + 6).CreateCell(11).SetCellValue(t.WeldingMethodName);
|
||
// recordSheet.GetRow(i + 6).GetCell(11).CellStyle = styleCenter;
|
||
|
||
// string weldMat = "";
|
||
// if (!string.IsNullOrEmpty(t.JOT_WeldSilk))
|
||
// {
|
||
// var consumables = Funs.DB.Base_Consumables.FirstOrDefault(x => x.ConsumablesId == t.JOT_WeldSilk);
|
||
// if (consumables != null)
|
||
// {
|
||
// weldMat = consumables.ConsumablesName;
|
||
// }
|
||
// }
|
||
// if (!string.IsNullOrEmpty(t.JOT_WeldMat))
|
||
// {
|
||
// var consumables = Funs.DB.Base_Consumables.FirstOrDefault(x => x.ConsumablesId == t.JOT_WeldMat);
|
||
// if (consumables != null)
|
||
// {
|
||
// if (!string.IsNullOrEmpty(weldMat))
|
||
// {
|
||
// weldMat += "," + consumables.ConsumablesName;
|
||
// }
|
||
// else
|
||
// {
|
||
// weldMat = consumables.ConsumablesName;
|
||
|
||
// }
|
||
// }
|
||
// }
|
||
// recordSheet.GetRow(i + 6).CreateCell(12).SetCellValue(weldMat);
|
||
// recordSheet.GetRow(i + 6).GetCell(12).CellStyle = styleCenter;
|
||
|
||
// if (t.JOT_PrepareTemp.HasValue)
|
||
// {
|
||
// recordSheet.GetRow(i + 6).CreateCell(14).SetCellValue(t.JOT_PrepareTemp.Value.ToString("##.#"));
|
||
// recordSheet.GetRow(i + 6).GetCell(14).CellStyle = styleCenter;
|
||
|
||
// }
|
||
// recordSheet.GetRow(i + 6).CreateCell(16).SetCellValue("合格");
|
||
// recordSheet.GetRow(i + 6).GetCell(16).CellStyle = styleCenter;
|
||
// #endregion
|
||
// // checkItems.Add(checkItem);
|
||
// i++;
|
||
|
||
// }
|
||
// using (FileStream filess = File.OpenWrite(ReportFileName))
|
||
// {
|
||
// hssfworkbook.Write(filess);
|
||
// }
|
||
// //PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReportId, isoId, varValue, this.CurrUser.LoginProjectId)));
|
||
|
||
// FileInfo filet = new FileInfo(ReportFileName);
|
||
// Response.Clear();
|
||
// Response.Charset = "GB2312";
|
||
// Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||
// // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
|
||
// Response.AddHeader("Content-Disposition", "attachment; filename=管道焊接接头报检检查记录_" + 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();
|
||
//}
|
||
|
||
//else if (printType.SelectedValue == "4")
|
||
//{
|
||
|
||
// Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||
// var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(q.WorkAreaId);
|
||
// var install = BLL.Project_InstallationService.GetInstallationByInstallationId(workArea.InstallationId);
|
||
// var project = BLL.ProjectService.GetProjectByProjectId(q.ProjectId);
|
||
// keyValuePairs.Add("ProjecctName", project.ProjectName);//工程名称
|
||
// keyValuePairs.Add("WorkAreaName", workArea.WorkAreaName);//单位工程名称
|
||
|
||
|
||
// String strSql1 = @" select iso.ISO_IsoNo,jot.JOT_JointNo,PointCount,RequiredT,ActualT,RequestTime,ActualTime,ProessDate,RecordChartNo ,m.MaterialCode,JOT_JointDesc
|
||
// from PW_JointInfo jot left join PW_IsoInfo iso on jot.ISO_ID=iso.ISO_ID
|
||
// left join HJGL_HotProess_Report hot on jot.JOT_ID = hot.WeldJointId
|
||
// left join Base_Material m on jot.MaterialId=m.MaterialId WHERE hot.WeldJointId is not null and jot.ProjectId= @projectId AND jot.ISO_ID=@isoId ";
|
||
|
||
|
||
// List<SqlParameter> listStr1 = new List<SqlParameter>
|
||
// {
|
||
// new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
|
||
// new SqlParameter("@isoId", this.tvControlItem.SelectedNodeID),
|
||
// };
|
||
// if (!string.IsNullOrEmpty(this.txtJOT_JointNo.Text.Trim()))
|
||
// {
|
||
// strSql1 += " AND jot.JOT_JointNo LIKE @JOT_JointNo";
|
||
// listStr1.Add(new SqlParameter("@JOT_JointNo", "%" + this.txtJOT_JointNo.Text.Trim() + "%"));
|
||
// }
|
||
// if (!string.IsNullOrEmpty(this.dpIsHj.SelectedValue))
|
||
// {
|
||
// strSql1 += " AND jot.is_hj = @is_hj";
|
||
// listStr1.Add(new SqlParameter("@is_hj", this.dpIsHj.SelectedValue));
|
||
// }
|
||
// strSql1 += " order by JOT_JointNo ";
|
||
|
||
// SqlParameter[] parameter1 = listStr1.ToArray();
|
||
// DataTable tb = SQLHelper.GetDataTableRunText(strSql1, parameter1);
|
||
|
||
// BLL.Common.FastReportService.ResetData();
|
||
// BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
|
||
|
||
// tb.TableName = "Table1";
|
||
// BLL.Common.FastReportService.AddFastreportTable(tb);
|
||
|
||
// string initTemplatePath = "";
|
||
// string rootPath = Server.MapPath("~/");
|
||
|
||
// initTemplatePath = "File\\Fastreport\\管道焊接接头热处理报告.frx";
|
||
|
||
// if (File.Exists(rootPath + initTemplatePath))
|
||
// {
|
||
// PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../TrustManage/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
||
|
||
// }
|
||
|
||
//}
|
||
//}
|
||
//else
|
||
//{
|
||
// Alert.ShowInTop("请选择管线!", MessageBoxIcon.Warning);
|
||
// return;
|
||
//}
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop("请选择施工区域!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
} |