431 lines
19 KiB
C#
431 lines
19 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using BLL;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace FineUIPro.Web.HJGL.TestPackageManage
|
|
{
|
|
public partial class TestPackageManageAudit : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 试压包主键
|
|
/// </summary>
|
|
public string PTP_ID
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["PTP_ID"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["PTP_ID"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 试压包号
|
|
/// </summary>
|
|
public string PTP_TestPackageNo
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["PTP_TestPackageNo"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["PTP_TestPackageNo"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载页面
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.drpTestPackagePrintType.DataTextField = "Text";
|
|
this.drpTestPackagePrintType.DataValueField = "Value";
|
|
this.drpTestPackagePrintType.DataSource = BLL.DropListService.HJGL_TP_PrintListItem();
|
|
this.drpTestPackagePrintType.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpTestPackagePrintType);
|
|
|
|
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
|
this.drpInstallationId.DataTextField = "Text";
|
|
this.drpInstallationId.DataValueField = "Value";
|
|
this.drpInstallationId.DataSource = BLL.Project_InstallationService.GetInstallationList(this.CurrUser.LoginProjectId);
|
|
this.drpInstallationId.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpInstallationId);
|
|
this.InitTreeMenu();//加载树
|
|
}
|
|
}
|
|
#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.GetProjectListByUserId(this.CurrUser.UserId, "1");
|
|
foreach (var item in projects)
|
|
{
|
|
TreeNode rootProjectNode = new TreeNode();//定义根节点
|
|
rootProjectNode.Text = item.ProjectCode;
|
|
rootProjectNode.NodeID = item.ProjectId;
|
|
rootProjectNode.Expanded = true;
|
|
rootProjectNode.ToolTip = "施工号";
|
|
rootNode.Nodes.Add(rootProjectNode);
|
|
|
|
var iso = (from x in Funs.DB.HJGL_PW_IsoInfo
|
|
where x.ProjectId == item.ProjectId
|
|
select x.PressureTestPackageNo).Distinct();
|
|
if (iso.Count() > 0)
|
|
{
|
|
foreach (var packageNo in iso)
|
|
{
|
|
if (!string.IsNullOrEmpty(packageNo))
|
|
{
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = packageNo;
|
|
newNode.NodeID = packageNo;
|
|
newNode.EnableClickEvent = true;
|
|
rootProjectNode.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.EmptyText();//清空文本框
|
|
this.PTP_TestPackageNo = tvControlItem.SelectedNodeID;
|
|
this.PageInfoLoad(); ///页面输入提交信息
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 数据绑定
|
|
/// <summary>
|
|
/// 数据绑定
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
string strSql = @"SELECT IsoInfo.ISO_ID,"
|
|
+ @"IsoInfo.ProjectId,"
|
|
+ @"IsoInfo.ISO_IsoNo,"
|
|
+ @"IsoInfo.PressureTestPackageNo,"
|
|
+ @"IsoInfo.ISO_DesignPress,"
|
|
+ @"IsoInfo.ISO_DesignTemperature,"
|
|
+ @"IsoInfo.ISO_TestPress,"
|
|
+ @"IsoInfo.LeakageTest,"
|
|
+ @"Steel.STE_Name,"
|
|
+ @"TestPackage.PTP_OperationMedium,"
|
|
+ @"TestPackage.PTP_PurgingMedium,"
|
|
+ @"TestPackage.PTP_CleaningMedium,"
|
|
+ @"TestPackage.PTP_TestAmbientTemp,"
|
|
+ @"TestPackage.PTP_TestService,"
|
|
+ @"TestPackage.PTP_TestMediumTemp"
|
|
+ @" FROM dbo.HJGL_PW_IsoInfo AS IsoInfo"
|
|
+ @" LEFT JOIN dbo.HJGL_TP_TestPackage AS TestPackage ON TestPackage.PTP_TestPackageNo = IsoInfo.PressureTestPackageNo"
|
|
+ @" LEFT JOIN dbo.HJGL_BS_Steel AS Steel ON Steel.STE_ID = IsoInfo.STE_ID "
|
|
+ @" WHERE IsoInfo.ProjectId= @ProjectId "
|
|
+ @" AND IsoInfo.PressureTestPackageNo=@PressureTestPackageNo";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
|
listStr.Add(new SqlParameter("@PressureTestPackageNo", this.PTP_TestPackageNo));
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
// 2.获取当前分页数据
|
|
//var table = this.GetPagedDataTable(Grid1, tb1);
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
|
|
#region 加载页面输入提交信息
|
|
/// <summary>
|
|
/// 加载页面输入提交信息
|
|
/// </summary>
|
|
private void PageInfoLoad()
|
|
{
|
|
var tm = BLL.HJGL_TestPackageManageEditService.GetTestPackageByTestPackageNo(this.PTP_TestPackageNo);
|
|
if (tm != null)
|
|
{
|
|
this.PTP_ID = tm.PTP_ID;
|
|
if (!string.IsNullOrEmpty(this.PTP_ID))
|
|
{
|
|
var testPackageManage = BLL.HJGL_TestPackageManageEditService.GetTP_TestPackageByID(this.PTP_ID);
|
|
if (testPackageManage != null)
|
|
{
|
|
this.txtPTP_TestPackageNo.Text = testPackageManage.PTP_TestPackageNo;
|
|
this.txtPTP_TestPackageName.Text = testPackageManage.PTP_TestPackageName;
|
|
if (!string.IsNullOrEmpty(testPackageManage.InstallationId))
|
|
{
|
|
this.drpInstallationId.SelectedValue = testPackageManage.InstallationId;
|
|
}
|
|
this.txtPTP_TestAmbientTemp.Text = testPackageManage.PTP_TestAmbientTemp;
|
|
this.txtPTP_TestService.Text = testPackageManage.PTP_TestService;
|
|
this.txtPTP_TestMediumTemp.Text = testPackageManage.PTP_TestMediumTemp;
|
|
this.txtPTP_OperationMedium.Text = testPackageManage.PTP_OperationMedium;
|
|
this.txtPTP_PurgingMedium.Text = testPackageManage.PTP_PurgingMedium;
|
|
this.txtPTP_CleaningMedium.Text = testPackageManage.PTP_CleaningMedium;
|
|
this.drpPressureTest.SelectedValue = testPackageManage.PressureTest.ToString();
|
|
this.txtIsolationRemoval.Text = testPackageManage.IsolationRemoval;
|
|
this.drpOpenValve.SelectedValue = testPackageManage.OpenValve.ToString();
|
|
if (testPackageManage.WaterSpecification == "1")
|
|
{
|
|
this.cbWaterSpecification.Checked = true;
|
|
}
|
|
this.txtInstallationSpecification.Text = testPackageManage.InstallationSpecification;
|
|
this.drpComponentReinspection.SelectedValue = testPackageManage.ComponentReinspection.ToString();
|
|
this.txtWorkRecord.Text = testPackageManage.WorkRecord;
|
|
if (testPackageManage.NDTConform == "1")
|
|
{
|
|
this.cbNDTConform.Checked = true;
|
|
}
|
|
if (testPackageManage.HotConform == "1")
|
|
{
|
|
this.cbHotConform.Checked = true;
|
|
}
|
|
this.txtInstallationCorrectness.Text = testPackageManage.InstallationCorrectness;
|
|
if (testPackageManage.MarkClearly == "1")
|
|
{
|
|
this.cbMarkClearly.Checked = true;
|
|
}
|
|
this.txtIsolationOpening.Text = testPackageManage.IsolationOpening;
|
|
this.txtConstructionPlanAsk.Text = testPackageManage.ConstructionPlanAsk;
|
|
this.txtCover.Text = testPackageManage.Cover;
|
|
this.txtMeetRequirements.Text = testPackageManage.MeetRequirements;
|
|
if (testPackageManage.StainlessTestWater == true)
|
|
{
|
|
this.cbStainlessTestWater.Checked = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.txtPTP_TestPackageNo.Text = this.PTP_TestPackageNo;
|
|
this.txtInstallationSpecification.Text = "符合要求";
|
|
this.txtCover.Text = "未覆盖";
|
|
this.txtIsolationRemoval.Text = "已隔离和拆除";
|
|
this.txtConstructionPlanAsk.Text = "符合要求";
|
|
this.txtMeetRequirements.Text = "符合要求";
|
|
this.txtIsolationOpening.Text = "已隔离和开启";
|
|
this.txtWorkRecord.Text = "齐全";
|
|
this.txtInstallationCorrectness.Text = "正确";
|
|
}
|
|
}
|
|
#endregion
|
|
#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 btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_TestPackageManageAuditMenuId, Const.BtnSave))
|
|
{
|
|
Model.HJGL_TP_TestPackage newTestPackage = new Model.HJGL_TP_TestPackage();
|
|
newTestPackage.PTP_TestPackageNo = this.txtPTP_TestPackageNo.Text.Trim();
|
|
newTestPackage.PTP_TestPackageName = this.txtPTP_TestPackageName.Text.Trim();
|
|
newTestPackage.PTP_TestService = this.txtPTP_TestService.Text.Trim();
|
|
newTestPackage.PTP_TestAmbientTemp = this.txtPTP_TestAmbientTemp.Text.Trim();
|
|
newTestPackage.PTP_TestMediumTemp = this.txtPTP_TestMediumTemp.Text.Trim();
|
|
newTestPackage.PTP_OperationMedium = this.txtPTP_OperationMedium.Text.Trim();
|
|
newTestPackage.PTP_PurgingMedium = this.txtPTP_PurgingMedium.Text.Trim();
|
|
newTestPackage.PTP_CleaningMedium = this.txtPTP_CleaningMedium.Text.Trim();
|
|
newTestPackage.ProjectId = this.CurrUser.LoginProjectId;
|
|
if (this.drpInstallationId.SelectedValue!=BLL.Const._Null)
|
|
{
|
|
newTestPackage.InstallationId = this.drpInstallationId.SelectedValue;
|
|
}
|
|
newTestPackage.PressureTest = Convert.ToBoolean(this.drpPressureTest.SelectedValue);
|
|
newTestPackage.IsolationRemoval = this.txtIsolationRemoval.Text.Trim();
|
|
newTestPackage.OpenValve = Convert.ToBoolean(this.drpOpenValve.SelectedValue);
|
|
if (cbWaterSpecification.Checked)
|
|
{
|
|
newTestPackage.WaterSpecification = "1";
|
|
}
|
|
newTestPackage.InstallationSpecification = this.txtInstallationSpecification.Text.Trim();
|
|
newTestPackage.WorkRecord = this.txtWorkRecord.Text.Trim();
|
|
if(cbNDTConform.Checked)
|
|
{
|
|
newTestPackage.NDTConform = "1";
|
|
}
|
|
if (cbHotConform.Checked)
|
|
{
|
|
newTestPackage.HotConform = "1";
|
|
}
|
|
newTestPackage.InstallationCorrectness = this.txtInstallationCorrectness.Text.Trim();
|
|
newTestPackage.IsolationOpening = this.txtIsolationOpening.Text.Trim();
|
|
newTestPackage.Cover = this.txtCover.Text.Trim();
|
|
newTestPackage.ConstructionPlanAsk = this.txtConstructionPlanAsk.Text.Trim();
|
|
newTestPackage.MeetRequirements = this.txtMeetRequirements.Text.Trim();
|
|
if(this.cbStainlessTestWater.Checked)
|
|
{
|
|
newTestPackage.StainlessTestWater = true;
|
|
}
|
|
newTestPackage.ComponentReinspection = Convert.ToBoolean(this.drpComponentReinspection.SelectedValue);
|
|
if(this.cbMarkClearly.Checked)
|
|
{
|
|
newTestPackage.MarkClearly = "1";
|
|
}
|
|
if (!string.IsNullOrEmpty(this.PTP_ID))
|
|
{
|
|
newTestPackage.PTP_ID = this.PTP_ID;
|
|
BLL.HJGL_TestPackageManageEditService.UpdateTP_TestPackage(newTestPackage);
|
|
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改试压包");
|
|
}
|
|
else
|
|
{
|
|
this.PTP_ID = SQLHelper.GetNewID(typeof(Model.HJGL_TP_TestPackage));
|
|
newTestPackage.PTP_ID = this.PTP_ID;
|
|
BLL.HJGL_TestPackageManageEditService.AddTP_TestPackage(newTestPackage);
|
|
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加试压包");
|
|
}
|
|
BindGrid();
|
|
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 清空文本框
|
|
/// <summary>
|
|
/// 清空文本框
|
|
/// </summary>
|
|
private void EmptyText()
|
|
{
|
|
this.txtPTP_TestPackageNo.Text = string.Empty;
|
|
this.txtPTP_TestPackageName.Text = string.Empty;
|
|
this.drpInstallationId.SelectedValue = BLL.Const._Null;
|
|
this.txtPTP_TestAmbientTemp.Text = string.Empty;
|
|
this.txtPTP_TestService.Text = string.Empty;
|
|
this.txtPTP_TestMediumTemp.Text = string.Empty;
|
|
this.txtPTP_OperationMedium.Text = string.Empty;
|
|
this.txtPTP_PurgingMedium.Text = string.Empty;
|
|
this.txtPTP_CleaningMedium.Text = string.Empty;
|
|
this.txtInstallationSpecification.Text = string.Empty;
|
|
this.txtCover.Text = string.Empty;
|
|
this.txtIsolationRemoval.Text = string.Empty;
|
|
this.txtConstructionPlanAsk.Text = string.Empty;
|
|
this.txtMeetRequirements.Text = string.Empty;
|
|
this.txtIsolationOpening.Text = string.Empty;
|
|
this.txtWorkRecord.Text = string.Empty;
|
|
this.txtInstallationCorrectness.Text = string.Empty;
|
|
}
|
|
#endregion
|
|
|
|
#region 试压包打印
|
|
/// <summary>
|
|
/// 试压包打印
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnPrint_Click(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(this.PTP_TestPackageNo))
|
|
{
|
|
string reportId = string.Empty;
|
|
if (this.drpTestPackagePrintType.SelectedValue != BLL.Const._Null)
|
|
{
|
|
if (this.drpTestPackagePrintType.SelectedValue == "1")
|
|
{
|
|
reportId = BLL.Const.HJGL_TestPackageReportOneId; // 管道吹扫/清洗检验记录
|
|
}
|
|
else if (this.drpTestPackagePrintType.SelectedValue == "2")
|
|
{
|
|
reportId = BLL.Const.HJGL_TestPackageReportTwoId; // 管道系统耐压试验条件确认与试验记录(一)
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请选择打印类型",MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", reportId, this.PTP_TestPackageNo, null)));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请选择试压包!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |