124 lines
5.8 KiB
C#
124 lines
5.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using Microsoft.Reporting.WebForms;
|
|
|
|
namespace FineUIPro.Web.Report
|
|
{
|
|
public partial class ReportPrint : System.Web.UI.Page
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
string report = Request.QueryString["report"];
|
|
if (report == "1")
|
|
{
|
|
string trustBatchId = Request.QueryString["trustBatchId"];
|
|
var trust = BLL.Batch_BatchTrustService.GetBatchTrustById(trustBatchId);
|
|
var ins = BLL.Project_WorkAreaService.GetProject_WorkAreaByWorkAreaId(trust.WorkAreaId);
|
|
string wbs = string.Empty;
|
|
if (ins != null)
|
|
{
|
|
wbs = ins.WorkAreaCode;
|
|
}
|
|
|
|
string trustCode = string.Empty;
|
|
string nde = string.Empty;
|
|
string trustDate = string.Empty;
|
|
string standard = string.Empty;
|
|
string isRt = string.Empty;
|
|
string ndeUnit = string.Empty;
|
|
string projectName = string.Empty;
|
|
if (trust != null)
|
|
{
|
|
trustCode = trust.TrustBatchCode;
|
|
trustDate = trust.TrustDate.HasValue ? string.Format("{0:yyyy-MM-dd}", trust.TrustDate) : "";
|
|
var n = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(trust.DetectionTypeId);
|
|
if (n != null)
|
|
{
|
|
nde = n.DetectionTypeCode;
|
|
if (n.SysType == "光谱检测")
|
|
{
|
|
standard = "40-010-00-0-0-00-003,ASTM,SH3501,Q/SH 0706-2016";
|
|
}
|
|
else
|
|
{
|
|
standard = "NB/T47013-2015, ASME B31.3-2010, SH3517-2013";
|
|
}
|
|
|
|
if (n.SysType == "射线检测")
|
|
{
|
|
isRt = "AB";
|
|
}
|
|
}
|
|
var project = BLL.Base_ProjectService.GetProjectByProjectId(trust.ProjectId);
|
|
if (project != null)
|
|
{
|
|
var protype = BLL.Base_ProjectTypeService.GetProjectTypeByProjectTypeId(project.ProjectTypeId);
|
|
if (protype.ProjectTypeName == "大项目")
|
|
{
|
|
trustCode = "CTP-" + trustCode;
|
|
}
|
|
else
|
|
{
|
|
trustCode = "CTE-" + trustCode;
|
|
}
|
|
projectName = project.ProjectName;
|
|
}
|
|
|
|
var unit = BLL.Base_UnitService.GetUnit(trust.NDEUuit);
|
|
if (unit != null)
|
|
{
|
|
ndeUnit = unit.UnitCode;
|
|
}
|
|
}
|
|
string strSql = @"SELECT ROW_NUMBER() OVER(ORDER BY WeldJointCode) AS Number,
|
|
TrustBatchItemId, TrustBatchId, InstallationCode, WorkAreaCode,
|
|
PipelineCode, WeldJointCode,JointArea, MaterialCode, Size, Thickness,
|
|
WeldTypeCode, WelderCode, WeldingMethodCode, DetectionRateCode,
|
|
AcceptLevel, Sheet
|
|
FROM dbo.View_Batch_BatchTrustItem WHERE TrustBatchId=@TrustBatchId";
|
|
List<SqlParameter> parms = new List<SqlParameter>();
|
|
parms.Add(new SqlParameter("@TrustBatchId", trustBatchId));
|
|
SqlParameter[] parameter = parms.ToArray();
|
|
DataTable dt = BLL.SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
ReportDataSource rds = new ReportDataSource("DataSet1", dt);
|
|
ReportViewer1.LocalReport.ReportPath = "Report/BatchTrust.rdlc";
|
|
ReportViewer1.LocalReport.DataSources.Add(rds);
|
|
|
|
List<ReportParameter> paras = new List<ReportParameter>();
|
|
paras.Add(new ReportParameter("TrustCode", trustCode));
|
|
paras.Add(new ReportParameter("Ndt", nde));
|
|
paras.Add(new ReportParameter("TrustDate", trustDate));
|
|
paras.Add(new ReportParameter("Standard", standard));
|
|
paras.Add(new ReportParameter("WBS", wbs));
|
|
paras.Add(new ReportParameter("IsRT", isRt));
|
|
paras.Add(new ReportParameter("NDEUnit", ndeUnit));
|
|
paras.Add(new ReportParameter("ProjectName", projectName));
|
|
|
|
ReportViewer1.LocalReport.SetParameters(paras);
|
|
|
|
}
|
|
if (report == "2")
|
|
{
|
|
List<SqlParameter> parms = new List<SqlParameter>();
|
|
parms.Add(new SqlParameter("@Account", "gly"));
|
|
SqlParameter[] parameter = parms.ToArray();
|
|
DataTable dt = BLL.SQLHelper.GetDataTableRunProc("spTestReport", parameter);
|
|
|
|
ReportViewer1.LocalReport.ReportPath = "Report/Report2.rdlc";
|
|
ReportDataSource rds = new ReportDataSource("DataSet1", dt);
|
|
|
|
ReportViewer1.LocalReport.DataSources.Add(rds);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |