HJGL_DS/HJGL_DS/FineUIPro.Web/JGZL/IndustrialPipelineInstallat...

250 lines
12 KiB
C#

using BLL;
using FastReport;
using Model;
using Org.BouncyCastle.Crypto.Tls;
using Org.BouncyCastle.Ocsp;
using System;
using System.Collections.Generic;
namespace FineUIPro.Web.JGZL
{
public partial class IndustrialPipelineInstallationSummaryEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string SummaryId
{
get
{
return (string)ViewState["SummaryId"];
}
set
{
ViewState["SummaryId"] = value;
}
}
/// <summary>
/// 项目Id
/// </summary>
private string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
/// <summary>
/// 外键—CertificateId
/// </summary>
public string CertificateId
{
get
{
return (string)ViewState["CertificateId"];
}
set
{
ViewState["CertificateId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ProjectId = Request.Params["projectId"];
this.SummaryId = Request.Params["summaryId"];
if (!string.IsNullOrWhiteSpace(this.ProjectId))
{
//获取下拉选择项本项目下所有工业管道安装质量证明书信息
IndustrialPipelineInstallationQualityCertificateService.InitIndustrialPipelineInstallationQualityCertificateDownList(this.drpCertificateCode, this.ProjectId, false);
this.drpPipelineCode.DataTextField = "ISO_IsoNo";
this.drpPipelineCode.DataValueField = "ISO_ID";
this.drpPipelineCode.DataSource = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByProjectId(this.ProjectId);
this.drpPipelineCode.DataBind();
Funs.FineUIPleaseSelect(this.drpPipelineCode);
}
if (!string.IsNullOrEmpty(this.SummaryId))
{
var report = BLL.IndustrialPipelineInstallationSummaryService.GetIndustrialPipelineInstallationSummaryById(this.SummaryId);
if (report != null)
{
this.ProjectId = report.ProjectId;
IndustrialPipelineInstallationQualityCertificateService.InitIndustrialPipelineInstallationQualityCertificateDownList(this.drpCertificateCode, this.ProjectId, false);
this.drpPipelineCode.DataTextField = "ISO_IsoNo";
this.drpPipelineCode.DataValueField = "ISO_ID";
this.drpPipelineCode.DataSource = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByProjectId(this.ProjectId);
this.drpPipelineCode.DataBind();
Funs.FineUIPleaseSelect(this.drpPipelineCode);
if (!string.IsNullOrEmpty(report.CertificateId))
{
this.drpCertificateCode.SelectedValue = report.CertificateId;
var certificate = BLL.IndustrialPipelineInstallationQualityCertificateService.GetIndustrialPipelineInstallationQualityCertificateById(report.CertificateId);
if (certificate != null)
{
this.txtDeliveryUnit.Text = certificate.DeliveryUnit;
this.txtDeliveryUnitCode.Text = certificate.DeliveryUnitCode;
}
}
if (!string.IsNullOrEmpty(report.PipelineCode))
{
this.drpPipelineCode.SelectedValue = report.PipelineCode;
}
this.txtPipelineLevel.Text = report.PipelineLevel;
this.txtPipelineStartPoint.Text = report.PipelineStartPoint;
this.txtPipelineEndPoint.Text = report.PipelineEndPoint;
this.txtDesignPressure.Text = report.DesignPressure;
this.txtDesignTemperature.Text = report.DesignTemperature;
//this.txtOperatingTemperature.Text = report.OperatingTemperature;
this.txtMedium.Text = report.Medium;
this.txtMaterial.Text = report.Material;
this.txtSpecifications.Text = report.Specifications;
this.txtLength.Text = report.Length;
this.txtLayingMethod.Text = report.LayingMethod;
this.txtWeldsNum.Text = report.WeldsNum;
this.txtLosslessRatio.Text = report.LosslessRatio;
//this.txtVoltageResistantTestMethod.Text = report.VoltageResistantTestMethod;
this.txtVoltageResistantTestMedium.Text = report.VoltageResistantTestMedium;
this.txtVoltageResistantTestPressure.Text = report.VoltageResistantTestPressure;
//this.txtVoltageResistantTestDate.Text = report.VoltageResistantTestDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.VoltageResistantTestDate) : "";
this.txtLeakageTestMedium.Text = report.LeakageTestMedium;
this.txtLeakageTestPressure.Text = report.LeakageTestPressure;
//this.txtLeakageTestDate.Text = report.LeakageTestDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.LeakageTestDate) : "";
this.txtCleaningMethod.Text = report.CleaningMethod;
this.txtCorrosionControlMethod.Text = report.CorrosionControlMethod;
this.txtInsulationMethod.Text = report.InsulationMethod;
this.txtRemarks.Text = report.Remark;
}
}
}
}
/// <summary>
/// 选择质量证明书编号
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpCertificateCode_SelectedIndexChanged(object sender, EventArgs e)
{
if (!string.IsNullOrWhiteSpace(this.drpCertificateCode.SelectedValue))
{
this.CertificateId = this.drpCertificateCode.SelectedValue;
#region
var certificate = BLL.IndustrialPipelineInstallationQualityCertificateService.GetIndustrialPipelineInstallationQualityCertificateById(this.CertificateId);
if (certificate != null)
{
this.txtDeliveryUnit.Text = certificate.DeliveryUnit;
this.txtDeliveryUnitCode.Text = certificate.DeliveryUnitCode;
}
#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.JGZL_IndustrialPipelineInstallationSummaryMenuId, Const.BtnSave))
{
if (this.drpCertificateCode.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpCertificateCode.SelectedValue))
{
Alert.ShowInTop("请选择证明书编号!", MessageBoxIcon.Warning);
return;
}
if (this.drpPipelineCode.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpPipelineCode.SelectedValue))
{
Alert.ShowInTop("请选择单线图号!", MessageBoxIcon.Warning);
return;
}
Model.JGZL_IndustrialPipelineInstallationSummary newReport = new Model.JGZL_IndustrialPipelineInstallationSummary();
newReport.CertificateId = this.drpCertificateCode.SelectedValue;
newReport.PipelineCode = this.drpPipelineCode.SelectedValue;
newReport.PipelineLevel = this.txtPipelineLevel.Text.Trim();
newReport.PipelineStartPoint = this.txtPipelineStartPoint.Text.Trim();
newReport.PipelineEndPoint = this.txtPipelineEndPoint.Text.Trim();
newReport.DesignPressure = this.txtDesignPressure.Text.Trim();
newReport.DesignTemperature = this.txtDesignTemperature.Text.Trim();
//newReport.OperatingTemperature = this.txtOperatingTemperature.Text.Trim();
newReport.Medium = this.txtMedium.Text.Trim();
newReport.Material = this.txtMaterial.Text.Trim();
newReport.Specifications = this.txtSpecifications.Text.Trim();
newReport.Length = this.txtLength.Text.Trim();
newReport.LayingMethod = this.txtLayingMethod.Text.Trim();
newReport.WeldsNum = this.txtWeldsNum.Text.Trim();
newReport.LosslessRatio = this.txtLosslessRatio.Text.Trim();
//newReport.VoltageResistantTestMethod = this.txtVoltageResistantTestMethod.Text.Trim();
newReport.VoltageResistantTestMedium = this.txtVoltageResistantTestMedium.Text.Trim();
newReport.VoltageResistantTestPressure = this.txtVoltageResistantTestPressure.Text.Trim();
//newReport.VoltageResistantTestDate = Funs.GetNewDateTime(this.txtVoltageResistantTestDate.Text);
newReport.LeakageTestMedium = this.txtLeakageTestMedium.Text.Trim();
newReport.LeakageTestPressure = this.txtLeakageTestPressure.Text.Trim();
//newReport.LeakageTestDate = Funs.GetNewDateTime(this.txtLeakageTestDate.Text);
newReport.CleaningMethod = this.txtCleaningMethod.Text.Trim();
newReport.CorrosionControlMethod = this.txtCorrosionControlMethod.Text.Trim();
newReport.InsulationMethod = this.txtInsulationMethod.Text.Trim();
newReport.Remark = this.txtRemarks.Text.Trim();
if (!string.IsNullOrEmpty(this.SummaryId))
{
newReport.SummaryId = this.SummaryId;
//newReport.CertificateId = this.drpCertificateCode.SelectedValue;
BLL.IndustrialPipelineInstallationSummaryService.UpdateIndustrialPipelineInstallationSummary(newReport);
}
else
{
//newReport.CertificateId = this.drpCertificateCode.SelectedValue;
newReport.ProjectId = this.ProjectId;
newReport.CompileMan = this.CurrUser.UserId;
newReport.CompileDate = DateTime.Now;
newReport.Reviewer = this.CurrUser.UserId;
newReport.RevieweDate = DateTime.Now;
newReport.SummaryId = SQLHelper.GetNewID(typeof(Model.JGZL_IndustrialPipelineInstallationSummary));
this.SummaryId = newReport.SummaryId;
BLL.IndustrialPipelineInstallationSummaryService.AddIndustrialPipelineInstallationSummary(newReport);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
protected void drpPipelineCode_SelectedIndexChanged(object sender, EventArgs e)
{
SGGLDB db = Funs.DB;
this.txtWeldsNum.Text = string.Empty;
if (this.drpPipelineCode.SelectedValue!=BLL.Const._Null&&!string.IsNullOrEmpty(this.drpPipelineCode.SelectedValue))
{
int jointCount = BLL.HJGL_PW_JointInfoService.GetJointCountByIsoId(this.drpPipelineCode.SelectedValue);
this.txtWeldsNum.Text = jointCount.ToString();
}
}
}
}