650 lines
30 KiB
C#
650 lines
30 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using BLL;
|
||
using System.Data.SqlClient;
|
||
using System.Data;
|
||
using System.Web;
|
||
|
||
namespace FineUIPro.Web.HJGL.CheckManage
|
||
{
|
||
public partial class TestingReportPrint : PageBase
|
||
{
|
||
#region 加载
|
||
/// <summary>
|
||
/// 加载页面
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
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.drpNDT.DataTextField = "NDT_Code";
|
||
this.drpNDT.DataValueField = "NDT_ID";
|
||
this.drpNDT.DataSource = BLL.HJGL_TestingService.GetNDTTypeNameList();
|
||
this.drpNDT.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpNDT);
|
||
//是否打印
|
||
this.drpIsPrint.DataTextField = "Text";
|
||
this.drpIsPrint.DataValueField = "Value";
|
||
this.drpIsPrint.DataSource = BLL.DropListService.IsTrueOrFalseDrpList();
|
||
this.drpIsPrint.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpIsPrint);
|
||
|
||
this.InitTreeMenu();//加载树
|
||
//this.BindGrid();
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
this.InitTreeMenu();
|
||
}
|
||
|
||
#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 != null && this.drpProjectId.SelectedValue != "null")
|
||
{
|
||
projects = projects.Where(x => x.ProjectId == this.drpProjectId.SelectedValue).ToList();
|
||
}
|
||
|
||
foreach (var item in projects)
|
||
{
|
||
TreeNode rootProjectNode = new TreeNode();//定义根节点
|
||
rootProjectNode.Text = item.ProjectCode;
|
||
rootProjectNode.NodeID = item.ProjectId;
|
||
//rootProjectNode.Expanded = false;
|
||
rootProjectNode.EnableExpandEvent = true;
|
||
rootProjectNode.ToolTip = item.ProjectName;
|
||
rootProjectNode.CommandName = "施工号";
|
||
rootNode.Nodes.Add(rootProjectNode);
|
||
|
||
TreeNode tn = new TreeNode();
|
||
tn.NodeID = "temp";
|
||
tn.Text = "正在加载...";
|
||
|
||
rootProjectNode.Nodes.Add(tn);
|
||
|
||
//List<Model.HJGL_BO_Batch> batchLists = (from x in Funs.DB.HJGL_BO_Batch
|
||
// where x.ProjectId == item.ProjectId
|
||
// select x).ToList();
|
||
//this.BindNodes(rootProjectNode, batchLists, dt);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 绑定树节点
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void tvControlItem_NodeExpand(object sender, TreeNodeEventArgs e)
|
||
{
|
||
if (e.Node.Nodes != null)
|
||
{
|
||
e.Node.Nodes.Clear();
|
||
}
|
||
string node = e.NodeID;
|
||
List<Model.HJGL_BO_Batch> batchLists = (from x in Funs.DB.HJGL_BO_Batch
|
||
where x.ProjectId == e.NodeID
|
||
select x).ToList();
|
||
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
listStr.Add(new SqlParameter("@ProjectId", e.NodeID));
|
||
SqlParameter[] parameter = listStr.ToArray();
|
||
DataTable dt = SQLHelper.GetDataTableRunProc("HJGL_spTestingReportPrint", parameter);
|
||
|
||
this.BindNodes(e.Node, batchLists, dt);
|
||
}
|
||
/// <summary>
|
||
/// 绑定树节点
|
||
/// </summary>
|
||
/// <param name="node"></param>
|
||
private void BindNodes(TreeNode node, List<Model.HJGL_BO_Batch> batchLists, DataTable dt)
|
||
{
|
||
if (node.CommandName == "施工号")
|
||
{
|
||
|
||
var batchList = (from x in batchLists orderby x.BatchCode descending select x).Distinct();
|
||
foreach (var item in batchList)
|
||
{
|
||
DataRow[] drArr = dt.Select("BatchId='" + item.BatchId + "' and IsPrint=0");//查询
|
||
if (this.rblPrint.SelectedValue == "0")
|
||
{
|
||
if (drArr.Count() > 0)
|
||
{
|
||
TreeNode newNode = new TreeNode();
|
||
newNode.Text = string.Format("{0:yyyy-MM-dd}", item.BatchStartDate) + " " + item.BatchCode;
|
||
newNode.NodeID = item.BatchId;
|
||
newNode.ToolTip = "日期-批编号";
|
||
newNode.CommandName = "批编号";
|
||
newNode.EnableClickEvent = true;
|
||
node.Nodes.Add(newNode);
|
||
}
|
||
}
|
||
else if (this.rblPrint.SelectedValue == "1")
|
||
{
|
||
if (drArr.Count() == 0)
|
||
{
|
||
TreeNode newNode = new TreeNode();
|
||
newNode.Text = "<font color='#009966'>" + string.Format("{0:yyyy-MM-dd}", item.BatchStartDate) + " " + item.BatchCode + "</font>";
|
||
newNode.NodeID = item.BatchId;
|
||
newNode.ToolTip = "日期-批编号";
|
||
newNode.CommandName = "批编号";
|
||
newNode.EnableClickEvent = true;
|
||
node.Nodes.Add(newNode);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
TreeNode newNode = new TreeNode();
|
||
if (drArr.Count() == 0)
|
||
{
|
||
newNode.Text = "<font color='#009966'>" + string.Format("{0:yyyy-MM-dd}", item.BatchStartDate) + " " + item.BatchCode + "</font>";
|
||
}
|
||
else
|
||
{
|
||
newNode.Text = string.Format("{0:yyyy-MM-dd}", item.BatchStartDate) + " " + item.BatchCode;
|
||
}
|
||
newNode.NodeID = item.BatchId;
|
||
newNode.ToolTip = "日期-批编号";
|
||
newNode.CommandName = "批编号";
|
||
newNode.EnableClickEvent = true;
|
||
node.Nodes.Add(newNode);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region TreeView点击事件
|
||
/// <summary>
|
||
/// TreeView点击事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
||
{
|
||
this.BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
protected void rblPrint_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
this.InitTreeMenu();
|
||
}
|
||
|
||
#region 绑定数据
|
||
/// <summary>
|
||
/// 绑定数据
|
||
/// </summary>
|
||
private void BindGrid()
|
||
{
|
||
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID) && !string.IsNullOrEmpty(this.tvControlItem.SelectedNode.ParentNode.NodeID))
|
||
{
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
listStr.Add(new SqlParameter("@ProjectId", this.tvControlItem.SelectedNode.ParentNode.NodeID));
|
||
|
||
if (this.drpNDT.SelectedValue != BLL.Const._Null)
|
||
{
|
||
listStr.Add(new SqlParameter("@NDT", this.drpNDT.SelectedText));
|
||
}
|
||
if (this.drpIsPrint.SelectedValue != BLL.Const._Null)
|
||
{
|
||
listStr.Add(new SqlParameter("@IsPrint", Convert.ToBoolean(this.drpIsPrint.SelectedValue)));
|
||
}
|
||
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
||
{
|
||
listStr.Add(new SqlParameter("@BatchId", this.tvControlItem.SelectedNodeID));
|
||
}
|
||
|
||
SqlParameter[] parameter = listStr.ToArray();
|
||
DataTable tb = SQLHelper.GetDataTableRunProc("HJGL_spTestingReportPrint", 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 Grid行点击事件
|
||
/// <summary>
|
||
/// Grid行点击事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
||
{
|
||
object[] reportIds = Grid1.DataKeys[e.RowIndex];
|
||
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();
|
||
string reportPrintId = isoId + "|" + jointDesc + "|" + ndtId + "|" + batchId + "|" + JOT_JointNo;
|
||
reportPrintId = HttpUtility.UrlEncodeUnicode(reportPrintId);
|
||
var iso = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(isoId);
|
||
string projectId = iso.ProjectId;
|
||
|
||
if (e.CommandName == "edit")//编辑
|
||
{
|
||
if (ndtCode.Contains("RT"))
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RTReportEdit.aspx?reportPrintId={0}&STE_ID={1}&STE_ID2={2}&WME_ID={3}", reportPrintId, STE_ID, STE_ID2, WME_ID, "编辑 - ")));
|
||
}
|
||
else if (ndtCode.Contains("PT"))
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PTReportEdit.aspx?reportPrintId={0}&STE_ID={1}&STE_ID2={2}&WME_ID={3}", reportPrintId, STE_ID, STE_ID2, WME_ID, "编辑 - ")));
|
||
}
|
||
else if (ndtCode.Contains("MT"))
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MTReportEdit.aspx?reportPrintId={0}&STE_ID={1}&STE_ID2={2}&WME_ID={3}", reportPrintId, STE_ID, STE_ID2, WME_ID, "编辑 - ")));
|
||
}
|
||
else if (ndtCode.Contains("UT"))
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("UTReportEdit.aspx?reportPrintId={0}&STE_ID={1}&STE_ID2={2}&WME_ID={3}", reportPrintId, STE_ID, STE_ID2, WME_ID, "编辑 - ")));
|
||
}
|
||
}
|
||
if (e.CommandName == "print")//打印
|
||
{
|
||
var rtReport = BLL.HJGL_TestingReportPrintService.GetTestingReportPrint(isoId, jointDesc, ndtId, batchId, STE_ID, STE_ID2, WME_ID);
|
||
if (rtReport != null)
|
||
{
|
||
string reportId1 = string.Empty;//报表Id
|
||
string reportId2 = string.Empty;//报表Id第二面
|
||
int rowNum = 28;
|
||
string testingReportPrintId = rtReport.TestingReportPrintId;
|
||
rtReport.Printer = this.CurrUser.UserName;
|
||
if (rtReport.PrintTime == null)
|
||
{
|
||
rtReport.PrintTime = DateTime.Now;
|
||
}
|
||
BLL.HJGL_TestingReportPrintService.UpdateTestingReportPrint(rtReport);
|
||
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
listStr.Add(new SqlParameter("@TestingReportPrintId", testingReportPrintId));
|
||
listStr.Add(new SqlParameter("@RowNum", rowNum));
|
||
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_TestingReportPrintItem", parameter);
|
||
|
||
if (ndtCode.Contains("RT"))
|
||
{
|
||
reportId1 = BLL.Const.HJGL_RTReportId1;
|
||
reportId2 = BLL.Const.HJGL_RTReportId2;
|
||
rowNum = 25;
|
||
}
|
||
else if (ndtCode.Contains("PT"))
|
||
{
|
||
reportId1 = BLL.Const.HJGL_PTReportId1;
|
||
reportId2 = BLL.Const.HJGL_PTReportId2;
|
||
}
|
||
else if (ndtCode.Contains("MT"))
|
||
{
|
||
reportId1 = BLL.Const.HJGL_MTReportId1;
|
||
reportId2 = BLL.Const.HJGL_MTReportId2;
|
||
}
|
||
else if (ndtCode.Contains("UT"))
|
||
{
|
||
reportId1 = BLL.Const.HJGL_UTReportId1;
|
||
reportId2 = BLL.Const.HJGL_UTReportId2;
|
||
}
|
||
string printTime = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||
if (rtReport.PrintTime != null)
|
||
{
|
||
printTime = string.Format("{0:yyyy-MM-dd}", rtReport.PrintTime);
|
||
}
|
||
|
||
int count = tb.Rows.Count;
|
||
string pageNum = string.Empty;
|
||
if (ndtCode.Contains("RT"))
|
||
{
|
||
pageNum = Funs.GetPagesCountByPageSize(rowNum, 39, count).ToString();
|
||
}
|
||
else
|
||
{
|
||
pageNum = Funs.GetPagesCountByPageSize(rowNum, 42, count).ToString();
|
||
}
|
||
string varValue = printTime + "|" + pageNum;
|
||
varValue = HttpUtility.UrlEncodeUnicode(varValue);
|
||
string replaceParameter = testingReportPrintId + "|" + rowNum + "|" + STE_ID + "|" + STE_ID2 + "|" + WME_ID;
|
||
|
||
if (tb.Rows.Count > 0)
|
||
{
|
||
if (tb.Rows.Count <= rowNum)
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", reportId1, replaceParameter, varValue)));
|
||
}
|
||
else
|
||
{
|
||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", reportId2, replaceParameter, varValue)));
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", reportId1, replaceParameter, varValue)));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("无拍片记录!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请先编辑检测报告!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
if (e.CommandName == "printNew")//打印新报表
|
||
{
|
||
var rtReport = BLL.HJGL_TestingReportPrintService.GetTestingReportPrint(isoId, jointDesc, ndtId, batchId, STE_ID, STE_ID2, WME_ID);
|
||
if (rtReport != null)
|
||
{
|
||
string reportId1 = string.Empty;//报表Id
|
||
string reportId2 = string.Empty;//报表Id第二面
|
||
int rowNum = 22;
|
||
string testingReportPrintId = rtReport.TestingReportPrintId;
|
||
rtReport.Printer = this.CurrUser.UserName;
|
||
if (rtReport.PrintTime == null)
|
||
{
|
||
rtReport.PrintTime = DateTime.Now;
|
||
}
|
||
BLL.HJGL_TestingReportPrintService.UpdateTestingReportPrint(rtReport);
|
||
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
listStr.Add(new SqlParameter("@TestingReportPrintId", testingReportPrintId));
|
||
listStr.Add(new SqlParameter("@RowNum", rowNum));
|
||
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_TestingReportPrintItem", parameter);
|
||
|
||
if (ndtCode.Contains("RT"))
|
||
{
|
||
reportId1 = BLL.Const.HJGL_RTNewReportId1;
|
||
reportId2 = BLL.Const.HJGL_RTNewReportId2;
|
||
rowNum = 22;
|
||
}
|
||
else if (ndtCode.Contains("PT"))
|
||
{
|
||
reportId1 = BLL.Const.HJGL_PTNewReportId1;
|
||
reportId2 = BLL.Const.HJGL_PTNewReportId2;
|
||
}
|
||
else if (ndtCode.Contains("MT"))
|
||
{
|
||
reportId1 = BLL.Const.HJGL_MTNewReportId1;
|
||
reportId2 = BLL.Const.HJGL_MTNewReportId2;
|
||
}
|
||
else if (ndtCode.Contains("UT"))
|
||
{
|
||
reportId1 = BLL.Const.HJGL_UTNewReportId1;
|
||
reportId2 = BLL.Const.HJGL_UTNewReportId2;
|
||
}
|
||
string printTime = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||
if (rtReport.PrintTime != null)
|
||
{
|
||
printTime = string.Format("{0:yyyy-MM-dd}", rtReport.PrintTime);
|
||
}
|
||
|
||
int count = tb.Rows.Count;
|
||
string pageNum = string.Empty;
|
||
if (ndtCode.Contains("RT"))
|
||
{
|
||
pageNum = Funs.GetPagesCountByPageSize(rowNum, 29, count).ToString();
|
||
}
|
||
else
|
||
{
|
||
pageNum = Funs.GetPagesCountByPageSize(rowNum, 28, count).ToString();
|
||
}
|
||
string varValue = printTime + "|" + pageNum;
|
||
varValue = HttpUtility.UrlEncodeUnicode(varValue);
|
||
string replaceParameter = testingReportPrintId + "|" + rowNum + "|" + STE_ID + "|" + STE_ID2 + "|" + WME_ID;
|
||
|
||
if (tb.Rows.Count > 0)
|
||
{
|
||
if (tb.Rows.Count <= rowNum)
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", reportId1, replaceParameter, varValue)));
|
||
}
|
||
else
|
||
{
|
||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", reportId2, replaceParameter, varValue)));
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", reportId1, replaceParameter, varValue)));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("无拍片记录!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请先编辑检测报告!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
|
||
if (e.CommandName == "fileName")//文档名
|
||
{
|
||
var rtReport = BLL.HJGL_TestingReportPrintService.GetTestingReportPrint(isoId, jointDesc, ndtId, batchId, STE_ID, STE_ID2, WME_ID);
|
||
var ndtType = BLL.HJGL_TestingService.GetTestingByTestingId(ndtId);
|
||
if (rtReport != null)
|
||
{
|
||
string code = string.Empty;
|
||
DateTime date = DateTime.Now.Date;
|
||
string year = string.Empty;
|
||
string month = string.Empty;
|
||
string dateStr = string.Empty;
|
||
int rowNum = 28;
|
||
if (date.Day <= 20) //报告时间段按上月21日到本月20日止,如2018年1月21日到2月20日出具的检测编号编为“1802”
|
||
{
|
||
if (date.Month < 10)
|
||
{
|
||
month = "0" + date.Month.ToString();
|
||
}
|
||
else
|
||
{
|
||
month = date.Month.ToString();
|
||
}
|
||
year = date.Year.ToString().Substring(2);
|
||
}
|
||
else
|
||
{
|
||
date = date.AddMonths(1);
|
||
if (date.Month < 10)
|
||
{
|
||
month = "0" + date.Month.ToString();
|
||
}
|
||
else
|
||
{
|
||
month = date.Month.ToString();
|
||
}
|
||
year = date.Year.ToString().Substring(2);
|
||
}
|
||
dateStr = year + month;
|
||
string reportCode = string.Empty;
|
||
if (!string.IsNullOrEmpty(rtReport.ReportCode) && rtReport.ReportCode.Length > 3)
|
||
{
|
||
reportCode = rtReport.ReportCode.Substring(3);
|
||
}
|
||
string unitName = string.Empty;
|
||
if (iso != null)
|
||
{
|
||
Model.Base_Unit unit = BLL.Base_UnitService.GetUnit(iso.BSU_ID);
|
||
if (unit != null)
|
||
{
|
||
unitName = unit.UnitName;
|
||
}
|
||
}
|
||
string projectCode = BLL.Base_ProjectService.GetProjectCode(projectId);
|
||
string projectName = string.Empty;
|
||
Model.Base_Project project = BLL.Base_ProjectService.GetProjectByProjectId(projectId);
|
||
if (project != null)
|
||
{
|
||
projectName = project.ProjectName;
|
||
}
|
||
string testingReportPrintId = rtReport.TestingReportPrintId;
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
listStr.Add(new SqlParameter("@TestingReportPrintId", testingReportPrintId));
|
||
listStr.Add(new SqlParameter("@RowNum", rowNum));
|
||
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_TestingReportPrintItem", parameter);
|
||
string userName = string.Empty;
|
||
Model.HJGL_CH_Trust trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(CH_TrustID);
|
||
if (trust != null)
|
||
{
|
||
Model.Sys_User user = BLL.Sys_UserService.GetUsersByUserId(trust.CH_TrustMan);
|
||
if (user != null)
|
||
{
|
||
userName = user.UserName;
|
||
}
|
||
}
|
||
if (ndtType.NDT_Code == "RT")
|
||
{
|
||
code = dateStr + "-RT-" + reportCode + "-" + unitName + "-" + projectCode + "-" + projectName + "(" + iso.ISO_IsoNo + ")-" + (tb.Rows.Count - 1).ToString();
|
||
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("FileCode.aspx?code={0}", HttpUtility.UrlEncodeUnicode(code), "编辑 - ")));
|
||
}
|
||
else if (ndtType.NDT_Code == "PT")
|
||
{
|
||
code = dateStr + "-PT-" + reportCode + "-" + unitName + "-" + projectCode + "-" + projectName + "(" + iso.ISO_IsoNo + ")-" + userName;
|
||
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("FileCode.aspx?code={0}", HttpUtility.UrlEncodeUnicode(code), "编辑 - ")));
|
||
}
|
||
else if (ndtType.NDT_Code == "MT")
|
||
{
|
||
code = dateStr + "-MT-" + reportCode + "-" + unitName + "-" + projectCode + "-" + projectName + "(" + iso.ISO_IsoNo + ")-" + userName;
|
||
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("FileCode.aspx?code={0}", HttpUtility.UrlEncodeUnicode(code), "编辑 - ")));
|
||
}
|
||
else if (ndtType.NDT_Code == "UT")
|
||
{
|
||
code = dateStr + "-UT-" + reportCode + "-" + unitName + "-" + projectCode + "-" + projectName + "(" + iso.ISO_IsoNo + ")-" + userName;
|
||
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("FileCode.aspx?code={0}", HttpUtility.UrlEncodeUnicode(code), "编辑 - ")));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请先编辑检测报告!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
|
||
if (e.CommandName == "ReportUpload")//报告上传
|
||
{
|
||
var rtReport = BLL.HJGL_TestingReportPrintService.GetTestingReportPrint(isoId, jointDesc, ndtId, batchId, STE_ID, STE_ID2, WME_ID);
|
||
if (rtReport != null)
|
||
{
|
||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader2.aspx?type=0&toKeyId={0}&path=FileUpload/TestingReport/&menuId={1}", rtReport.TestingReportPrintId, BLL.Const.PV_TestingReportPrint)));
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请先编辑检测报告!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 排序
|
||
/// <summary>
|
||
/// 排序
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_Sort(object sender, 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 ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#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 Window1_Close(object sender, EventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 查询
|
||
/// <summary>
|
||
/// 查询
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Text_TextChanged(object sender, EventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
}
|
||
} |