using System; using BLL; using System.Linq; using static System.Windows.Forms.VisualStyles.VisualStyleElement.Header; namespace FineUIPro.Web.WeldingProcess.WeldingManage { public partial class JointInfoEdit : PageBase { #region 定义项 /// /// 管线主键 /// private string PipelineId { get { return (string)ViewState["PipelineId"]; } set { ViewState["PipelineId"] = value; } } /// /// 焊口主键 /// public string WeldJointId { get { return (string)ViewState["WeldJointId"]; } set { ViewState["WeldJointId"] = value; } } /// /// 项目主键 /// public string ProjectId { get { return (string)ViewState["ProjectId"]; } set { ViewState["ProjectId"] = value; } } #endregion #region 加载页面 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.WeldJointId = Request.Params["WeldJointId"]; this.PipelineId = Request.Params["PipelineId"]; Model.Pipeline_Pipeline pipeline = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(this.PipelineId); if (pipeline != null) { this.ProjectId = pipeline.ProjectId; } var jointInfo = BLL.Pipeline_WeldJointService.GetViewWeldJointById(this.WeldJointId); if (jointInfo != null) { this.PipelineId = jointInfo.PipelineId; this.ProjectId = jointInfo.ProjectId; if (CurrUser.Account != Const.Gly && !string.IsNullOrEmpty(jointInfo.WeldingDailyId)) { btnSave.Hidden = true; } } ///初始化下拉框 this.LoadDropDownList(); ///初始化显示信息 this.LoadShowInfo(jointInfo); ////初始化页面信息 this.LoadPageInfo(jointInfo); } } #endregion #region 初始化页面信息 #region 加载下拉框 /// /// 加载下拉框 /// private void LoadDropDownList() { //管道等级 Base_PipingClassService.InitPipingClassDropDownList(this.drpPipingClass, true,Resources.Lan.PleaseSelect); ///焊接区域 //this.drpJointArea.DataTextField = "Text"; //this.drpJointArea.DataValueField = "Value"; //this.drpJointArea.DataSource = BLL.DropListService.HJGL_WLO_CODEItem(); //this.drpJointArea.DataBind(); //Funs.FineUIPleaseSelect(this.drpJointArea,Resources.Lan.PleaseSelect); ///材质1 Base_MaterialService.InitMaterialDropDownList(this.drpMaterial1, true,Resources.Lan.PleaseSelect); ///材质2 Base_MaterialService.InitMaterialDropDownList(this.drpMaterial2, true, Resources.Lan.PleaseSelect); ///焊缝类型 Base_WeldTypeService.InitWeldTypeDropDownList(this.drpWeldType, Resources.Lan.PleaseSelect, false); ///焊接方法 Base_WeldingMethodService.InitWeldingMethodDropDownList(this.drpWeldingMethod, true, Resources.Lan.PleaseSelect); ///坡口类型 Base_GrooveTypeService.InitGrooveTypeDropDownList(this.drpGrooveType, true,Resources.Lan.PleaseSelect); // 探伤类型 BLL.Base_DetectionTypeService.InitDetectionTypeDropDownList(this.drpNDTType, Resources.Lan.PleaseSelect, true, string.Empty);//探伤类型 Base_DNCompareService.InitDNCompareDropDownList(this.drpANSISCH, true); ///焊口属性 this.drpJointAttribute.DataTextField = "Text"; this.drpJointAttribute.DataValueField = "Value"; this.drpJointAttribute.DataSource = BLL.DropListService.HJGL_JointAttributeItem(); this.drpJointAttribute.DataBind(); Funs.FineUIPleaseSelect(this.drpJointAttribute,Resources.Lan.PleaseSelect); ///组件1号 Base_ComponentsService.InitComponentsDropDownList(this.drpPipeAssembly1, true,Resources.Lan.PleaseSelect); ///组件2号 Base_ComponentsService.InitComponentsDropDownList(this.drpPipeAssembly2, true, Resources.Lan.PleaseSelect); ///焊丝 Base_ConsumablesService.InitConsumablesDropDownList(this.drpWeldSilk, true, "1",Resources.Lan.PleaseSelect); ///焊条 Base_ConsumablesService.InitConsumablesDropDownList(this.drpWeldMat, true, "2", Resources.Lan.PleaseSelect); ///焊接位置 this.drpWeldingLocation.DataTextField = "WeldingLocationCode"; this.drpWeldingLocation.DataValueField = "WeldingLocationId"; this.drpWeldingLocation.DataSource = from x in Funs.DB.Base_WeldingLocation orderby x.WeldingLocationCode select x; this.drpWeldingLocation.DataBind(); ///是否热处理 this.drpIsHotProess.DataValueField = "Value"; this.drpIsHotProess.DataTextField = "Text"; this.drpIsHotProess.DataSource = DropListService.IsTrueOrFalseDrpList(); this.drpIsHotProess.DataBind(); Funs.FineUIPleaseSelect(this.drpIsHotProess,Resources.Lan.PleaseSelect); var wpsList = from x in Funs.DB.WPQ_WPQList where x.ProjectId == CurrUser.LoginProjectId select x; drpWPS.DataValueField = "WPQId"; drpWPS.DataTextField = "WPQCode"; drpWPS.DataSource = wpsList.ToList().OrderBy(x => x.WPQCode); drpWPS.DataBind(); Funs.FineUIPleaseSelect(drpWPS); } #endregion #region 加载页面显示信息 /// /// 加载页面显示信息 /// private void LoadShowInfo(Model.View_Pipeline_WeldJoint jointInfo) { this.txtReport.Text = Resources.Lan.WeldingWorkNotDone; this.txtPoint.Text = Resources.Lan.NDTJointNotSelected; this.ddlTrustFlag.Text = Resources.Lan.NotRequested; this.ddlCheckFlag.Text = Resources.Lan.NDTIsNotDone; if (jointInfo != null) { if (!string.IsNullOrEmpty(jointInfo.WeldingDailyId)) { this.txtReport.Text = Resources.Lan.WeldingAlready; //this.TextIsReadOnly(true); var dReport = BLL.Pipeline_WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(jointInfo.WeldingDailyId); if (dReport != null) { this.ddlReportCode.Text = dReport.WeldingDailyCode; this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", dReport.WeldingDate); this.txtBackingWelder.Text = jointInfo.BackingWelderCode; this.txtBackingWelderName.Text = jointInfo.BackingWelderName; this.txtCoverWelder.Text = jointInfo.CoverWelderCode; this.txtCoverWelderName.Text = jointInfo.CoverWelderName; } } // 焊口状态 var pointStatus = from x in Funs.DB.Batch_PointBatchItem where x.WeldJointId == jointInfo.WeldJointId && x.PointDate.HasValue select x; if (pointStatus.Count() > 0) { this.txtPoint.Text = "已点口"; } // 委托状态 var trustFlag = from x in Funs.DB.Batch_BatchTrustItem where x.WeldJointId == jointInfo.WeldJointId select x; if (trustFlag.Count() > 0) { this.ddlTrustFlag.Text = "已委托"; } // 探伤标志 var checkFlag = from x in Funs.DB.Batch_NDEItem join y in Funs.DB.Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId where y.WeldJointId == jointInfo.WeldJointId select x; if (checkFlag.Count() > 0) { this.ddlCheckFlag.Text = "已检测"; } } ///加载管线、区域、装置、单位 var pipeline = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(this.PipelineId); if (pipeline != null) { this.txtPipelineCode.Text = pipeline.PipelineCode; var workArea = BLL.Project_WorkAreaService.GetProject_WorkAreaByWorkAreaId(pipeline.WorkAreaId); if (workArea != null) { this.txtWorkAreaId.Text = workArea.WorkAreaCode; var installation = BLL.Project_InstallationService.GetProject_InstallationByInstallationId(workArea.InstallationId); if (installation != null) { this.lbInstallationName.Text = installation.InstallationName; } var unit = BLL.Base_UnitService.GetUnit(workArea.UnitId); if (unit != null) { this.lbUnitName.Text = unit.UnitName; } } txtSingleNumber.Text = pipeline.SingleNumber; } } #endregion #region 初始化页面信息 /// /// 初始化页面信息 /// protected void LoadPageInfo(Model.View_Pipeline_WeldJoint jointInfo) { if (jointInfo != null) { this.txtWeldJointCode.Text = jointInfo.WeldJointCode; if (!string.IsNullOrEmpty(jointInfo.PipingClassId)) { this.drpPipingClass.SelectedValue = jointInfo.PipingClassId; } //if (!string.IsNullOrEmpty(jointInfo.JointArea)) //{ // this.drpJointArea.SelectedValue = jointInfo.JointArea; //} this.txtPipeSegment.Text = jointInfo.PipeSegment; if (!string.IsNullOrEmpty(jointInfo.Material1Id)) { this.drpMaterial1.SelectedValue = jointInfo.Material1Id; } if (!string.IsNullOrEmpty(jointInfo.Material2Id)) { this.drpMaterial2.SelectedValue = jointInfo.Material2Id; } if (!string.IsNullOrEmpty(jointInfo.WeldTypeId)) { this.drpWeldType.SelectedValue = jointInfo.WeldTypeId; } if (!string.IsNullOrEmpty(jointInfo.ANSISCH)) { this.drpANSISCH.SelectedValue = jointInfo.ANSISCH; } this.txtSpecification.Text = jointInfo.Specification; if (jointInfo.Size != null) { this.txtSize.Text = jointInfo.Size.ToString(); } if (jointInfo.Dia != null) { this.txtDia.Text = jointInfo.Dia.ToString(); } if (jointInfo.Thickness != null) { this.txtThickness.Text = jointInfo.Thickness.ToString(); } if (!string.IsNullOrEmpty(jointInfo.WeldingMethodId)) { this.drpWeldingMethod.SelectedValue = jointInfo.WeldingMethodId; } if (!string.IsNullOrEmpty(jointInfo.GrooveTypeId)) { this.drpGrooveType.SelectedValue = jointInfo.GrooveTypeId; } if (!string.IsNullOrEmpty(jointInfo.JointAttribute)) { this.drpJointAttribute.SelectedValue = jointInfo.JointAttribute; } if (!string.IsNullOrEmpty(jointInfo.PipeAssembly1Id)) { this.drpPipeAssembly1.SelectedValue = jointInfo.PipeAssembly1Id; } if (!string.IsNullOrEmpty(jointInfo.PipeAssembly2Id)) { this.drpPipeAssembly2.SelectedValue = jointInfo.PipeAssembly2Id; } if (!string.IsNullOrEmpty(jointInfo.WeldSilkId)) { string[] weldsilkIds = jointInfo.WeldSilkId.Split(','); this.drpWeldSilk.SelectedValueArray = weldsilkIds; } if (!string.IsNullOrEmpty(jointInfo.WeldMatId)) { this.drpWeldMat.SelectedValue = jointInfo.WeldMatId; } if (!string.IsNullOrEmpty(jointInfo.WeldingLocationId)) { this.drpWeldingLocation.SelectedValue = jointInfo.WeldingLocationId; } if (jointInfo.IsHotProess == true) { this.drpIsHotProess.SelectedValue = BLL.Const._True; } else if (jointInfo.IsHotProess == false) { this.drpIsHotProess.SelectedValue = BLL.Const._False; } if (jointInfo.IsCancel == true) { ckbIsCancel.Checked = true; } if (jointInfo.IsGoldJoint == true) { ckbIsGoldJoint.Checked = true; } if (!string.IsNullOrEmpty(jointInfo.WPQId)) { this.drpWPS.SelectedValue = jointInfo.WPQId; } if (!string.IsNullOrEmpty(jointInfo.DetectionType)) { string[] ndts = jointInfo.DetectionType.Split('|'); this.drpNDTType.SelectedValueArray = ndts; } txtCancelResult.Text = jointInfo.CancelResult; this.txtSystemNumber.Text = jointInfo.SystemNumber; this.txtTestPackageNo.Text = jointInfo.TestPackageNo; this.txtPrepareTemp.Text = jointInfo.PrepareTemp; txtPageNum.Text = jointInfo.PageNum; if (!string.IsNullOrEmpty(jointInfo.Coode1)) { txtCoode1.Text = jointInfo.Coode1; BLL.MaterialCoodeService.InitHeartNoDropDownList(this.drpHeartNo1, txtCoode1.Text, true, Resources.Lan.PleaseSelect); drpHeartNo1.SelectedValue = jointInfo.Coode1; } if (!string.IsNullOrEmpty(jointInfo.Coode2)) { txtCoode2.Text = jointInfo.Coode2; BLL.MaterialCoodeService.InitHeartNoDropDownList(this.drpHeartNo2, txtCoode2.Text, true, Resources.Lan.PleaseSelect); drpHeartNo2.SelectedValue = jointInfo.Coode2; } this.txtRemark.Text = jointInfo.Remark; } } #endregion #region 文本框是否可编辑 /// /// 文本框是否可编辑 /// /// private void TextIsReadOnly(bool readOnly) { this.txtWeldJointCode.Readonly = readOnly; this.drpPipingClass.Readonly = readOnly; this.drpMaterial1.Readonly = readOnly; this.drpMaterial2.Readonly = readOnly; this.txtSize.Readonly = readOnly; this.txtDia.Readonly = readOnly; this.drpWeldType.Readonly = readOnly; this.drpWeldingMethod.Readonly = readOnly; drpGrooveType.Readonly = readOnly; drpWPS.Readonly = readOnly; drpNDTType.Readonly = readOnly; drpJointAttribute.Readonly = readOnly; } #endregion #endregion #region 保存按钮 /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_JointInfoMenuId, Const.BtnSave)) { if (string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()) || this.drpPipingClass.SelectedValue == BLL.Const._Null || this.drpMaterial1.SelectedValue == BLL.Const._Null || this.drpWeldType.SelectedValue == BLL.Const._Null || this.drpJointAttribute.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.txtSize.Text.Trim()) || string.IsNullOrEmpty(this.txtDia.Text.Trim()) || string.IsNullOrEmpty(this.txtThickness.Text.Trim()) || drpNDTType.SelectedValue==BLL.Const._Null || drpGrooveType.SelectedValue==BLL.Const._Null) { Alert.ShowInTop(Resources.Lan.RequestPages, MessageBoxIcon.Warning); return; } var weldType = BLL.Base_WeldTypeService.GetWeldTypeByWeldTypeId(this.drpWeldType.SelectedValue); if (weldType != null && weldType.WeldTypeCode != "SOB") { if (this.drpWeldingMethod.SelectedValue == BLL.Const._Null) { Alert.ShowInTop("焊接方法不能为空", MessageBoxIcon.Warning); return; } } if (BLL.Pipeline_WeldJointService.IsExistWeldJointCode(this.txtWeldJointCode.Text.Trim(), this.PipelineId, this.WeldJointId)) { Alert.ShowInTop(Resources.Lan.WeldingJointCodeExists, MessageBoxIcon.Warning); return; } Model.Pipeline_WeldJoint newJointInfo = new Model.Pipeline_WeldJoint(); newJointInfo.ProjectId = this.ProjectId; newJointInfo.PipelineId = this.PipelineId; newJointInfo.WeldJointCode = this.txtWeldJointCode.Text.Trim(); if (this.drpPipingClass.SelectedValue != BLL.Const._Null) { newJointInfo.PipingClassId = this.drpPipingClass.SelectedValue; } if (this.drpJointAttribute.SelectedValue != BLL.Const._Null) { newJointInfo.JointAttribute = this.drpJointAttribute.SelectedValue; if (this.drpJointAttribute.SelectedValue == "S") { newJointInfo.JointArea = "S"; } else { newJointInfo.JointArea = "F"; } } //if (this.drpJointArea.SelectedValue != BLL.Const._Null) //{ // newJointInfo.JointArea = this.drpJointArea.SelectedValue; //} newJointInfo.PipeSegment = this.txtPipeSegment.Text.Trim(); if (this.drpMaterial1.SelectedValue != BLL.Const._Null) { newJointInfo.Material1Id = this.drpMaterial1.SelectedValue; } if (this.drpMaterial2.SelectedValue != BLL.Const._Null) { newJointInfo.Material2Id = this.drpMaterial2.SelectedValue; } if (this.drpWeldType.SelectedValue != BLL.Const._Null) { newJointInfo.WeldTypeId = this.drpWeldType.SelectedValue; } if (this.drpANSISCH.SelectedValue != BLL.Const._Null) { newJointInfo.ANSISCH = this.drpANSISCH.SelectedValue; } newJointInfo.Specification = this.txtSpecification.Text.Trim(); newJointInfo.Size = Funs.GetNewDecimal(this.txtSize.Text.Trim()); newJointInfo.Dia = Funs.GetNewDecimal(this.txtDia.Text.Trim()); newJointInfo.Thickness = Funs.GetNewDecimal(this.txtThickness.Text.Trim()); if (this.drpWeldingMethod.SelectedValue != BLL.Const._Null) { newJointInfo.WeldingMethodId = this.drpWeldingMethod.SelectedValue; } if (this.drpGrooveType.SelectedValue != BLL.Const._Null) { newJointInfo.GrooveTypeId = this.drpGrooveType.SelectedValue; } if (this.drpPipeAssembly1.SelectedValue != BLL.Const._Null) { newJointInfo.PipeAssembly1Id = this.drpPipeAssembly1.SelectedValue; } if (this.drpPipeAssembly2.SelectedValue != BLL.Const._Null) { newJointInfo.PipeAssembly2Id = this.drpPipeAssembly2.SelectedValue; } if (this.drpWeldSilk.SelectedValue != BLL.Const._Null) { newJointInfo.WeldSilkId = string.Join(",", drpWeldSilk.SelectedValueArray); } if (this.drpWeldMat.SelectedValue != BLL.Const._Null) { newJointInfo.WeldMatId = this.drpWeldMat.SelectedValue; } if (this.drpIsHotProess.SelectedValue != BLL.Const._Null) { newJointInfo.IsHotProess = Convert.ToBoolean(this.drpIsHotProess.SelectedValue); } if (this.drpWeldingLocation.SelectedValue != BLL.Const._Null) { newJointInfo.WeldingLocationId = this.drpWeldingLocation.SelectedValue; } newJointInfo.SystemNumber = this.txtSystemNumber.Text.Trim(); newJointInfo.TestPackageNo = this.txtTestPackageNo.Text.Trim(); newJointInfo.PrepareTemp = this.txtPrepareTemp.Text.Trim(); newJointInfo.PageNum = txtPageNum.Text.Trim(); newJointInfo.Coode1 = txtCoode1.Text.Trim(); if (drpHeartNo1.SelectedValue != Const._Null) { newJointInfo.HeartNo1 = drpHeartNo1.SelectedValue; } newJointInfo.Coode2 = txtCoode2.Text.Trim(); if (drpHeartNo2.SelectedValue != Const._Null) { newJointInfo.HeartNo2 = drpHeartNo2.SelectedValue; } newJointInfo.Remark = this.txtRemark.Text.Trim(); newJointInfo.WPQId = drpWPS.SelectedValue; newJointInfo.DetectionType = string.Join("|", drpNDTType.SelectedValueArray); if (ckbIsCancel.Checked == true) { newJointInfo.IsCancel = true; } if (ckbIsGoldJoint.Checked == true) { newJointInfo.IsGoldJoint = true; } if (string.IsNullOrEmpty(this.WeldJointId)) { BLL.Pipeline_WeldJointService.AddWeldJoint(newJointInfo); BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_JointInfoMenuId, Const.BtnAdd, string.Empty); } else { newJointInfo.WeldJointId = this.WeldJointId; var jot = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(this.WeldJointId); if (!string.IsNullOrEmpty(jot.WeldingDailyId)) { BLL.Pipeline_WeldJointService.UpdateDepartWeldJoint(newJointInfo); } else { BLL.Pipeline_WeldJointService.UpdateWeldJoint(newJointInfo); } BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_JointInfoMenuId, Const.BtnModify, newJointInfo.WeldJointId); } PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); ShowNotify(Resources.Lan.SaveSuccessfully, MessageBoxIcon.Success); } else { Alert.ShowInTop(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning); return; } } #endregion protected void btnSelectWps_Click(object sender, EventArgs e) { drpWPS.Enabled = true; var wpsList = from x in Funs.DB.WPQ_WPQList where x.ProjectId == CurrUser.LoginProjectId select x; if (drpMaterial1.SelectedValue != Const._Null) { wpsList = wpsList.Where(x => x.MaterialId1.Contains(drpMaterial1.SelectedValue)); } if (drpMaterial2.SelectedValue != Const._Null) { wpsList = wpsList.Where(x => x.MaterialId1.Contains(drpMaterial2.SelectedValue) || x.MaterialId2.Contains(drpMaterial2.SelectedValue)); } if (drpWeldingMethod.SelectedValue != Const._Null) { wpsList = wpsList.Where(x => x.WeldingMethodId == drpWeldingMethod.SelectedValue); } if (txtDia.Text != "") { wpsList = wpsList.Where(x => x.MaxImpactDia>=Funs.GetNewDecimal(txtDia.Text) && x.MinImpactDia<= Funs.GetNewDecimal(txtDia.Text)); } if (txtThickness.Text != "") { wpsList = wpsList.Where(x => x.NoMaxImpactThickness >= Funs.GetNewDecimal(txtThickness.Text) && x.NoMinImpactThickness <= Funs.GetNewDecimal(txtThickness.Text)); } drpWPS.Items.Clear(); drpWPS.DataValueField = "WPQId"; drpWPS.DataTextField = "WPQCode"; drpWPS.DataSource = wpsList.ToList().OrderBy(x=>x.WPQCode); drpWPS.DataBind(); Funs.FineUIPleaseSelect(drpWPS); } protected void btnCancel_Click(object sender, EventArgs e) { if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_JointInfoMenuId, Const.BtnCancel)) { Model.Pipeline_WeldJoint update = Funs.DB.Pipeline_WeldJoint.FirstOrDefault(x => x.WeldJointId == this.WeldJointId); if (ckbIsCancel.Checked) { update.IsCancel = true; if (txtCancelResult.Text == "") { Alert.ShowInTop("取消原因不能为空!", MessageBoxIcon.Warning); return; } else { update.CancelResult = txtCancelResult.Text.Trim(); } } else { update.IsCancel = false; } Funs.DB.SubmitChanges(); ShowNotify(Resources.Lan.SaveSuccessfully, MessageBoxIcon.Success); } else { Alert.ShowInTop(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning); return; } } protected void drpWPS_OnSelectedIndexChanged(object sender, EventArgs e) { if (drpWPS.SelectedValue != Const._Null) { var wpsList = BLL.WPQListServiceService.GetWPQById(drpWPS.SelectedValue); if (wpsList != null) { //if(wpsList.) } //drpWeldSilk.SelectedValue } } protected void txtCoode1_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtCoode1.Text)) { drpHeartNo1.Items.Clear(); BLL.MaterialCoodeService.InitHeartNoDropDownList(this.drpHeartNo1, txtCoode1.Text, true, Resources.Lan.PleaseSelect);//HeartNo1 } } protected void txtCoode2_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtCoode2.Text)) { drpHeartNo2.Items.Clear(); BLL.MaterialCoodeService.InitHeartNoDropDownList(this.drpHeartNo2, txtCoode2.Text, true, Resources.Lan.PleaseSelect);//HeartNo2 } } #region 外径、壁厚输入框事件 /// /// 选择外径和壁厚自动获取规格 /// /// /// protected void drpANSISCH_OnSelectedIndexChanged(object sender, EventArgs e) { if (drpANSISCH.SelectedValue != Const._Null && txtSize.Text.Trim()!="") { string ansi = drpANSISCH.SelectedValue; string dia = string.Empty; string sch = string.Empty; var dn = from x in Funs.DB.Base_DNCompare where x.PipeSize == Funs.GetNewDecimal(txtSize.Text.Trim()) select x; if (dn.Count()>0) { if (ansi != "FB") { txtDia.Readonly = true; txtThickness.Readonly = true; if (dn.First().OutSizeDia != null) { dia = dn.First().OutSizeDia.ToString(); } if (ansi == "5") { if (dn.First().SCH5 != null) { sch = dn.First().SCH5.ToString(); } } if (ansi == "5S") { if (dn.First().SCH5S != null) { sch = dn.First().SCH5S.ToString(); } } if (ansi == "10") { if (dn.First().SCH10 != null) { sch = dn.First().SCH10.ToString(); } } if (ansi == "10S") { if (dn.First().SCH10S != null) { sch = dn.First().SCH10S.ToString(); } } if (ansi == "20") { if (dn.First().SCH20 != null) { sch = dn.First().SCH20.ToString(); } } if (ansi == "30") { if (dn.First().SCH30 != null) { sch = dn.First().SCH30.ToString(); } } if (ansi == "40") { if (dn.First().SCH40 != null) { sch = dn.First().SCH40.ToString(); } } if (ansi == "40S") { if (dn.First().SCH40S != null) { sch = dn.First().SCH40S.ToString(); } } if (ansi == "STD") { if (dn.First().STD != null) { sch = dn.First().STD.ToString(); } } if (ansi == "60") { if (dn.First().SCH60 != null) { sch = dn.First().SCH60.ToString(); } } if (ansi == "80") { if (dn.First().SCH80 != null) { sch = dn.First().SCH80.ToString(); } } if (ansi == "80S") { if (dn.First().SCH80S != null) { sch = dn.First().SCH80S.ToString(); } } if (ansi == "XS") { if (dn.First().XS != null) { sch = dn.First().XS.ToString(); } } if (ansi == "100") { if (dn.First().SCH100 != null) { sch = dn.First().SCH100.ToString(); } } if (ansi == "120") { if (dn.First().SCH120 != null) { sch = dn.First().SCH120.ToString(); } } if (ansi == "140") { if (dn.First().SCH140 != null) { sch = dn.First().SCH140.ToString(); } } if (ansi == "160") { if (dn.First().SCH160 != null) { sch = dn.First().SCH160.ToString(); } } if (ansi == "XXS") { if (dn.First().XXS != null) { sch = dn.First().XXS.ToString(); } } } else // 非美标FB { txtDia.Readonly = false; txtThickness.Readonly = false; //if (dn.First().OutSize_FB != null) //{ // dia = dn.First().OutSize_FB.ToString(); //} //if (dn.First().SCH_FB != null) //{ // sch = dn.First().SCH_FB.ToString(); //} } if (!string.IsNullOrEmpty(dia)) { txtDia.Text = dia; } if (!string.IsNullOrEmpty(sch)) { txtThickness.Text = sch; } if (!string.IsNullOrEmpty(dia) && !string.IsNullOrEmpty(sch)) { this.txtSpecification.Text = "Φ" + dia + "×" + sch; } } } } /// /// 选择外径和壁厚自动获取规格 /// /// /// protected void txtText_TextChanged(object sender, EventArgs e) { string dn = string.Empty; string s = string.Empty; if (!string.IsNullOrEmpty(this.txtDia.Text.Trim())) { dn = this.txtDia.Text.Trim(); if (!string.IsNullOrEmpty(this.txtThickness.Text.Trim())) { this.txtSpecification.Text = "Φ" + dn + "×" + this.txtThickness.Text.Trim(); } } } #endregion } }