using BLL; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace FineUIPro.Web.HJGL.WeldingManage { public partial class PipelineManageEdit : PageBase { #region 加载 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); BLL.Base_TestMediumService.InitMediumDropDownList(this.drpSER, true);//介质 BLL.Base_DetectionRateService.InitDetectionRateDropDownList(this.drpNDTRate, true);//探伤比例 BLL.Base_DetectionTypeService.InitDetectionTypeDropDownList(this.drpNDTName, true);//探伤类型 BLL.Base_MaterialService.InitMaterialDropDownList(this.drpSTEName, true,this.CurrUser.LoginProjectId);//材质 BLL.Base_PipingClassService.InitPipingClassDropDownList(this.drpIDName, true);//管道等级 string workAreaId = Request.Params["workAreaId"]; string ISO_ID = Request.Params["ISO_ID"]; if (!string.IsNullOrEmpty(ISO_ID)) { Model.PW_IsoInfo iso = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(ISO_ID); if (iso != null) { this.hdIsoNo.Text = iso.ISO_IsoNo; this.txtISO_IsoNo.Text = iso.ISO_IsoNo; this.txtUnitName.Text = BLL.UnitService.GetUnitNameByUnitId(iso.UnitId); if (!string.IsNullOrEmpty(iso.TestMediumId)) { this.drpSER.SelectedValue = iso.TestMediumId; } if (!string.IsNullOrEmpty(iso.DetectionRateId)) { this.drpNDTRate.SelectedValue = iso.DetectionRateId; } if (!string.IsNullOrEmpty(iso.DetectionTypeId)) { this.drpNDTName.SelectedValue = iso.DetectionTypeId; } if (!string.IsNullOrEmpty(iso.WorkAreaId)) { this.txtWorkArea.Text = BLL.WorkAreaService.getWorkAreaByWorkAreaId(iso.WorkAreaId).WorkAreaCode; } if (iso.Is_Standard) { this.rbIsStandard.SelectedValue = iso.Is_Standard.ToString().ToLower(); if (iso.Is_Standard) { this.drpNDTRate.Hidden = true; this.drpNDTName.Hidden = true; } } this.txtISO_SysNo.Text = iso.ISO_SysNo; this.txtISO_SubSysNo.Text = iso.ISO_SubSysNo; this.txtISO_CwpNo.Text = iso.ISO_CwpNo; this.txtISO_IsoNumber.Text = iso.ISO_IsoNumber; this.txtISO_Rev.Text = iso.ISO_Rev; this.txtISO_Sheet.Text = iso.ISO_Sheet; this.txtISO_PipeQty.Text = iso.ISO_PipeQty.HasValue ? iso.ISO_PipeQty.ToString() : ""; this.txtISO_Paint.Text = iso.ISO_Paint; this.txtISO_Insulator.Text = iso.ISO_Insulator; if (!string.IsNullOrEmpty(iso.MaterialId)) { this.drpSTEName.SelectedValue = iso.MaterialId; } this.txtISO_Executive.Text = iso.ISO_Executive; this.txtISO_Specification.Text = iso.ISO_Specification; this.txtISO_Modifier.Text = iso.ISO_Modifier; this.txtISO_ModifyDate.Text = iso.ISO_ModifyDate.HasValue ? string.Format("{0:yyyy-MM-dd}", iso.ISO_ModifyDate) : ""; this.txtISO_Creator.Text = iso.ISO_Creator; this.txtISO_CreateDate.Text = iso.ISO_CreateDate.HasValue ? string.Format("{0:yyyy-MM-dd}", iso.ISO_CreateDate) : ""; this.txtISO_DesignPress.Text = iso.ISO_DesignPress; this.txtISO_DesignTemperature.Text = iso.ISO_DesignTemperature; this.txtISO_TestPress.Text = iso.ISO_TestPress; this.txtISO_TestTemperature.Text = iso.ISO_TestTemperature ; if (!string.IsNullOrEmpty(iso.ISO_NDTClass)) { this.drpNDTClass.SelectedValue = iso.ISO_NDTClass; } this.txtISO_PTRate.Text = iso.ISO_PTRate; this.txtISO_PTClass.Text = iso.ISO_PTClass; if (iso.ISO_IfPickling != null) { if (iso.ISO_IfPickling == true) { this.drpISO_IfPickling.SelectedValue = "true"; } else { this.drpISO_IfPickling.SelectedValue = "false"; } } if (iso.ISO_IfChasing != null) { if (iso.ISO_IfChasing == true) { this.drpISO_IfChasing.SelectedValue = "true"; } else { this.drpISO_IfChasing.SelectedValue = "false"; } } if (!string.IsNullOrEmpty(iso.PipingClassId)) { this.drpIDName.SelectedValue = iso.PipingClassId; } this.txtCHT_ChecNo.Text = iso.CHT_CheckNo; this.txtISO_Remark.Text = iso.ISO_Remark; this.txtISOLength.Text = iso.ISO_Length; } } else { var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(workAreaId); if (workArea != null) { this.txtWorkArea.Text = workArea.WorkAreaCode; if (!string.IsNullOrEmpty(workArea.UnitId)) { this.txtUnitName.Text = BLL.UnitService.GetUnitNameByUnitId(workArea.UnitId); } } } } } #endregion #region 保存 /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { if (this.drpSER.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpSER.SelectedValue)) { Alert.ShowInTop("请选择介质!", MessageBoxIcon.Warning); return; } if (rbIsStandard.SelectedValue=="false"&&(this.drpNDTRate.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpNDTRate.SelectedValue))) { Alert.ShowInTop("请选择探伤比例!", MessageBoxIcon.Warning); return; } if (this.drpSTEName.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpSTEName.SelectedValue)) { Alert.ShowInTop("请选择材质!", MessageBoxIcon.Warning); return; } string workAreaId = Request.Params["workAreaId"]; string ISO_ID = Request.Params["ISO_ID"]; Model.PW_IsoInfo iso = new Model.PW_IsoInfo(); iso.ISO_IsoNo = this.txtISO_IsoNo.Text.Trim(); iso.TestMediumId = this.drpSER.SelectedValue; iso.Is_Standard = bool.Parse(rbIsStandard.SelectedValue); if (!iso.Is_Standard) { if (this.drpNDTRate.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpNDTRate.SelectedValue)) { iso.DetectionRateId = this.drpNDTRate.SelectedValue; } if (this.drpNDTName.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpNDTName.SelectedValue)) { iso.DetectionTypeId = this.drpNDTName.SelectedValue; } } else { iso.DetectionRateId = null; iso.DetectionTypeId = null; } if (this.drpNDTClass.SelectedValue != "0") { iso.ISO_NDTClass = this.drpNDTClass.SelectedValue; } iso.ISO_PTRate = this.txtISO_PTRate.Text.Trim(); iso.ISO_SysNo = this.txtISO_SysNo.Text.Trim(); iso.ISO_SubSysNo = this.txtISO_SubSysNo.Text.Trim(); iso.ISO_CwpNo = this.txtISO_CwpNo.Text.Trim(); iso.ISO_IsoNumber = this.txtISO_IsoNumber.Text.Trim(); iso.ISO_Rev = this.txtISO_Rev.Text.Trim(); iso.ISO_Sheet = this.txtISO_Sheet.Text.Trim(); iso.ISO_PipeQty = Funs.GetNewDecimal(this.txtISO_PipeQty.Text.Trim()); iso.ISO_Paint = this.txtISO_Paint.Text.Trim(); iso.ISO_Insulator = this.txtISO_Insulator.Text.Trim(); iso.MaterialId = this.drpSTEName.SelectedValue; iso.ISO_Executive = this.txtISO_Executive.Text.Trim(); iso.ISO_Specification = this.txtISO_Specification.Text.Trim(); iso.ISO_Modifier = this.txtISO_Modifier.Text.Trim(); iso.ISO_ModifyDate = Funs.GetNewDateTime(this.txtISO_ModifyDate.Text.Trim()); iso.ISO_Creator = this.txtISO_Creator.Text.Trim(); iso.ISO_CreateDate = Funs.GetNewDateTime(this.txtISO_CreateDate.Text.Trim()); iso.ISO_DesignPress = this.txtISO_DesignPress.Text.Trim(); iso.ISO_DesignTemperature = this.txtISO_DesignTemperature.Text.Trim(); iso.ISO_TestPress = this.txtISO_TestPress.Text.Trim(); iso.ISO_TestTemperature = this.txtISO_TestTemperature.Text.Trim(); iso.ISO_PTClass = this.txtISO_PTClass.Text.Trim(); if (this.drpISO_IfPickling.SelectedValue != "0") { iso.ISO_IfPickling = Convert.ToBoolean(this.drpISO_IfPickling.SelectedValue); } if (this.drpISO_IfChasing.SelectedValue != "0") { iso.ISO_IfChasing = Convert.ToBoolean(this.drpISO_IfChasing.SelectedValue); } if (this.drpIDName.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpIDName.SelectedValue)) { iso.PipingClassId = this.drpIDName.SelectedValue; } iso.CHT_CheckNo = this.txtCHT_ChecNo.Text.Trim(); iso.ISO_Remark = this.txtISO_Remark.Text.Trim(); if (!string.IsNullOrEmpty(ISO_ID)) { iso.ISO_ID = ISO_ID; if (this.txtISO_IsoNo.Text != this.hdIsoNo.Text.Trim()) { if (BLL.PW_IsoInfoService.IsExistIsoInfoCode(this.txtISO_IsoNo.Text.Trim(), workAreaId) == true) { Alert.ShowInTop("这个区域已存在这条管线,不能修改!"); return; } else { BLL.PW_IsoInfoService.UpdateIsoInfo(iso); } } else { BLL.PW_IsoInfoService.UpdateIsoInfo(iso); } } else { iso.ProjectId = this.CurrUser.LoginProjectId; var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(workAreaId); if (workArea != null) { iso.WorkAreaId = workAreaId; iso.UnitId = workArea.UnitId; } string newKeyID = SQLHelper.GetNewID(typeof(Model.PW_IsoInfo)); iso.ISO_ID = newKeyID; if (BLL.PW_IsoInfoService.IsExistIsoInfoCode(this.txtISO_IsoNo.Text.Trim(), workAreaId) == true) { Alert.ShowInTop("这个区域已存在这条管线,不能增加!"); return; } else { BLL.PW_IsoInfoService.AddIsoInfo(iso); } } ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } #endregion protected void rbIsStandard_SelectedIndexChanged(object sender, EventArgs e) { if (this.rbIsStandard.SelectedValue == "true") { this.drpNDTRate.Hidden = true; this.drpNDTName.Hidden = true; } else { this.drpNDTRate.Hidden = false; this.drpNDTName.Hidden = false; } } } }