356 lines
16 KiB
C#
356 lines
16 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.IO;
|
|
|
|
namespace FineUIPro.Web.JGZL
|
|
{
|
|
public partial class RTCheckReport : PageBase
|
|
{
|
|
#region 加载页面
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
//this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
|
|
|
this.drpProjectId.DataTextField = "ProjectCode";
|
|
this.drpProjectId.DataValueField = "ProjectId";
|
|
this.drpProjectId.DataSource = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
|
|
this.drpProjectId.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpProjectId);
|
|
|
|
this.drpProjectId.SelectedValue = this.CurrUser.LoginProjectId;
|
|
this.InitTreeMenu();//加载树
|
|
this.tvControlItem.SelectedNodeID = this.drpProjectId.SelectedValue;
|
|
this.BindGrid();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载树项目
|
|
/// <summary>
|
|
/// 加载树
|
|
/// </summary>
|
|
private void InitTreeMenu()
|
|
{
|
|
this.tvControlItem.Nodes.Clear();
|
|
TreeNode rootNode = new TreeNode();
|
|
rootNode.Text = "项目";
|
|
rootNode.ToolTip = "项目";
|
|
rootNode.NodeID = "0";
|
|
rootNode.Expanded = true;
|
|
this.tvControlItem.Nodes.Add(rootNode);
|
|
|
|
List<Model.Base_Project> projects = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
|
|
if (this.drpProjectId.SelectedValue != BLL.Const._Null)
|
|
{
|
|
projects = projects.Where(e => e.ProjectId == this.drpProjectId.SelectedValue).ToList();
|
|
}
|
|
foreach (var item in projects)
|
|
{
|
|
TreeNode rootProjectNode = new TreeNode();//定义根节点
|
|
rootProjectNode.Text = item.ProjectCode;
|
|
rootProjectNode.NodeID = item.ProjectId;
|
|
rootProjectNode.EnableClickEvent = true;
|
|
rootProjectNode.Expanded = true;
|
|
rootProjectNode.ToolTip = item.ProjectName;
|
|
rootProjectNode.CommandName = "项目名称";
|
|
rootNode.Nodes.Add(rootProjectNode);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 点击TreeView
|
|
/// <summary>
|
|
/// 点击TreeView
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
{
|
|
if (this.tvControlItem.SelectedNodeID != "0")
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 数据绑定
|
|
/// <summary>
|
|
/// 数据绑定
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@ProjectId", this.tvControlItem.SelectedNodeID));
|
|
listStr.Add(new SqlParameter("@NDT", "RT"));
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunProc("HJGL_sp_TestingReportPrint", parameter);
|
|
this.Grid1.RecordCount = tb.Rows.Count;
|
|
//tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
#endregion
|
|
|
|
#region 分页排序
|
|
#region 页索引改变事件
|
|
/// <summary>
|
|
/// 页索引改变事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 排序
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 分页选择下拉改变事件
|
|
/// <summary>
|
|
/// 分页选择下拉改变事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
#region 查询
|
|
///<summary>
|
|
///查询
|
|
///</summary>
|
|
///<param name="sender"></param>
|
|
///<param name="e"></param>
|
|
protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
this.InitTreeMenu();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 打印
|
|
/// <summary>
|
|
/// 打印
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnPrint_Click(object sender, EventArgs e)
|
|
{
|
|
string projectId = this.tvControlItem.SelectedNodeID;
|
|
|
|
if (projectId != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID))
|
|
{
|
|
string initTemplatePath = "";
|
|
string rootPath = Server.MapPath("~/");
|
|
BLL.Common.FastReportService.ResetData();
|
|
|
|
object[] reportIds = Grid1.DataKeys[this.Grid1.SelectedRowIndex];
|
|
string isoId = reportIds[0].ToString();
|
|
string jointDesc = reportIds[1].ToString();
|
|
string ndtId = reportIds[2].ToString();
|
|
string batchId = reportIds[3].ToString();
|
|
string ndtCode = reportIds[4].ToString();
|
|
string JOT_JointNo = reportIds[5].ToString();
|
|
string CH_TrustID = reportIds[6].ToString();
|
|
string STE_ID = reportIds[7].ToString();
|
|
string STE_ID2 = reportIds[8].ToString();
|
|
string WME_ID = reportIds[9].ToString();
|
|
|
|
|
|
var rtReport = BLL.HJGL_TestingReportPrintService.GetTestingReportPrint(isoId, jointDesc, ndtId, batchId, STE_ID, STE_ID2, WME_ID);
|
|
if (rtReport != null)
|
|
{
|
|
string testingReportPrintId = rtReport.TestingReportPrintId;
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@TestingReportPrintId", testingReportPrintId));
|
|
//listStr.Add(new SqlParameter("@RowNum", 0));
|
|
//listStr.Add(new SqlParameter("@Flag", "0"));
|
|
listStr.Add(new SqlParameter("@STE_ID", STE_ID));
|
|
listStr.Add(new SqlParameter("@STE_ID2", STE_ID2));
|
|
listStr.Add(new SqlParameter("@WME_ID", WME_ID));
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = BLL.SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_TestingReportPrint", parameter);
|
|
|
|
//明细表
|
|
List<SqlParameter> listStr2 = new List<SqlParameter>();
|
|
listStr2.Add(new SqlParameter("@TestingReportPrintId", testingReportPrintId));
|
|
//listStr2.Add(new SqlParameter("@RowNum", 0));
|
|
//listStr2.Add(new SqlParameter("@Flag", "0"));
|
|
listStr2.Add(new SqlParameter("@STE_ID", STE_ID));
|
|
listStr2.Add(new SqlParameter("@STE_ID2", STE_ID2));
|
|
listStr2.Add(new SqlParameter("@WME_ID", WME_ID));
|
|
SqlParameter[] parameter2 = listStr2.ToArray();
|
|
DataTable tb2 = BLL.SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_TestingReportPrintItem", parameter2);
|
|
|
|
DataTable dt = new DataTable();
|
|
dt.TableName = "MainData";
|
|
dt.Columns.Add("ProjectName");
|
|
dt.Columns.Add("InstallationName");
|
|
dt.Columns.Add("UnitName");
|
|
dt.Columns.Add("ReportCode");
|
|
dt.Columns.Add("WorkAreaCode");
|
|
dt.Columns.Add("TestCategoryNum");
|
|
dt.Columns.Add("CH_NDTCriteria");
|
|
dt.Columns.Add("CH_AcceptGrade");
|
|
dt.Columns.Add("STE_Code");
|
|
dt.Columns.Add("WME_Name");
|
|
dt.Columns.Add("RT_TechnicalGrade");
|
|
dt.Columns.Add("NDTR_Name");
|
|
dt.Columns.Add("TestingTime");
|
|
dt.Columns.Add("RT_DeveloperTemperature");
|
|
dt.Columns.Add("RT_DeveloperTime");
|
|
dt.Columns.Add("RT_FilmDensity");
|
|
dt.Columns.Add("Specifications");
|
|
dt.Columns.Add("TransilluminationMode");
|
|
dt.Columns.Add("WireDiameterCode");
|
|
dt.Columns.Add("FocalLength");
|
|
dt.Columns.Add("EffectiveLength");
|
|
dt.Columns.Add("TubeVoltageLineEnergy");
|
|
dt.Columns.Add("RT_TubeCurrent");
|
|
dt.Columns.Add("ExposureTime");
|
|
dt.Columns.Add("EquipmentSourceType");
|
|
dt.Columns.Add("RT_FocalSize");
|
|
dt.Columns.Add("IntensifyingWay");
|
|
dt.Columns.Add("FilmModel");
|
|
|
|
for (int row = 0; row < tb.Rows.Count; row++)
|
|
{
|
|
var newRows = dt.NewRow();
|
|
newRows["ProjectName"] = tb.Rows[row]["ProjectName"].ToString();
|
|
newRows["InstallationName"] = tb.Rows[row]["InstallationName"].ToString();
|
|
newRows["UnitName"] = tb.Rows[row]["UnitName"].ToString();
|
|
newRows["ReportCode"] = tb.Rows[row]["ReportCode"].ToString();
|
|
newRows["WorkAreaCode"] = tb.Rows[row]["WorkAreaCode"].ToString();
|
|
newRows["TestCategoryNum"] = tb.Rows[row]["TestCategoryNum"].ToString();
|
|
newRows["CH_NDTCriteria"] = tb.Rows[row]["CH_NDTCriteria"].ToString();
|
|
newRows["CH_AcceptGrade"] = tb.Rows[row]["CH_AcceptGrade"].ToString();
|
|
newRows["STE_Code"] = tb.Rows[row]["STE_Code"].ToString();
|
|
newRows["WME_Name"] = tb.Rows[row]["WME_Name"].ToString();
|
|
newRows["RT_TechnicalGrade"] = tb.Rows[row]["RT_TechnicalGrade"].ToString();
|
|
newRows["NDTR_Name"] = tb.Rows[row]["NDTR_Name"].ToString();
|
|
newRows["TestingTime"] = tb.Rows[row]["TestingTime"].ToString();
|
|
newRows["RT_DeveloperTemperature"] = tb.Rows[row]["RT_DeveloperTemperature"].ToString();
|
|
newRows["RT_DeveloperTime"] = tb.Rows[row]["RT_DeveloperTime"].ToString();
|
|
newRows["RT_FilmDensity"] = tb.Rows[row]["RT_FilmDensity"].ToString();
|
|
newRows["Specifications"] = tb.Rows[row]["Specifications"].ToString();
|
|
newRows["TransilluminationMode"] = tb.Rows[row]["TransilluminationMode"].ToString();
|
|
newRows["TransilluminationMode"] = tb.Rows[row]["TransilluminationMode"].ToString();
|
|
newRows["FocalLength"] = tb.Rows[row]["FocalLength"].ToString();
|
|
newRows["EffectiveLength"] = tb.Rows[row]["EffectiveLength"].ToString();
|
|
newRows["TubeVoltageLineEnergy"] = tb.Rows[row]["TubeVoltageLineEnergy"].ToString();
|
|
newRows["RT_TubeCurrent"] = tb.Rows[row]["RT_TubeCurrent"].ToString();
|
|
newRows["ExposureTime"] = tb.Rows[row]["ExposureTime"].ToString();
|
|
newRows["EquipmentSourceType"] = tb.Rows[row]["EquipmentSourceType"].ToString();
|
|
newRows["RT_FocalSize"] = tb.Rows[row]["RT_FocalSize"].ToString();
|
|
newRows["IntensifyingWay"] = tb.Rows[row]["IntensifyingWay"].ToString();
|
|
newRows["FilmModel"] = tb.Rows[row]["FilmModel"].ToString();
|
|
dt.Rows.Add(newRows);
|
|
}
|
|
BLL.Common.FastReportService.AddFastreportTable(dt);
|
|
|
|
DataTable dt2 = new DataTable();
|
|
dt2.TableName = "Data";
|
|
dt2.Columns.Add("BatchCode");
|
|
dt2.Columns.Add("ISO_IsoNo");
|
|
dt2.Columns.Add("JOT_JointNo");
|
|
dt2.Columns.Add("WED_Code");
|
|
dt2.Columns.Add("JOT_JointDesc");
|
|
dt2.Columns.Add("FilmNum");
|
|
dt2.Columns.Add("DefectNature");
|
|
dt2.Columns.Add("DefectRation");
|
|
dt2.Columns.Add("DefectResult");
|
|
dt2.Columns.Add("Remark");
|
|
|
|
DataView dv = tb2.DefaultView;//获取表视图
|
|
//dv.Sort = "JOT_JointNo ASC";//按照ID倒序排序
|
|
tb2 = dv.ToTable();//转为表
|
|
DataRow[] rows2 = tb2.DefaultView.ToTable().Select();
|
|
//int i = 0;
|
|
foreach (var row in rows2)
|
|
{
|
|
var newRows = dt2.NewRow();
|
|
newRows["BatchCode"] = row["BatchCode"].ToString();
|
|
newRows["ISO_IsoNo"] = row["ISO_IsoNo"].ToString();
|
|
newRows["JOT_JointNo"] = row["JOT_JointNo"].ToString();
|
|
newRows["WED_Code"] = row["WED_Code"].ToString();
|
|
newRows["JOT_JointDesc"] = row["JOT_JointDesc"].ToString();
|
|
newRows["FilmNum"] = row["FilmNum"].ToString();
|
|
newRows["DefectNature"] = row["DefectNature"].ToString();
|
|
newRows["DefectRation"] = row["DefectRation"].ToString();
|
|
newRows["DefectResult"] = row["DefectResult"].ToString();
|
|
newRows["Remark"] = row["Remark"].ToString();
|
|
dt2.Rows.Add(newRows);
|
|
//i++;
|
|
}
|
|
BLL.Common.FastReportService.AddFastreportTable(dt2);
|
|
|
|
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
|
//keyValuePairs.Add("ProjectName", BLL.Base_ProjectService.GetProjectByProjectId(projectId).ProjectName);
|
|
BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
|
|
|
|
initTemplatePath = "File\\Fastreport\\JGZL\\管道焊口射线检测报告.frx";
|
|
if (File.Exists(rootPath + initTemplatePath))
|
|
{
|
|
PageContext.RegisterStartupScript(WindowPrint.GetShowReference(String.Format("../common/ReportPrint/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
} |