using BLL; using FineUIPro.Web.HJGL.DataIn; using NPOI.SS.Formula.Functions; 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 JointInfoBatchModity : PageBase { #region 定义项 /// /// 管线主键 /// private string ISO_ID { get { return (string)ViewState["ISO_ID"]; } set { ViewState["ISO_ID"] = value; } } #endregion protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ///初始化下拉框 this.LoadDropDownList(); ///初始化显示信息 this.LoadShowInfo(); } } #region 初始化页面信息 #region 加载下拉框 /// /// 加载下拉框 /// private void LoadDropDownList() { ///材质1 this.ddlSTE1.DataTextField = "STE_Code"; this.ddlSTE1.DataValueField = "STE_ID"; this.ddlSTE1.DataSource = BLL.HJGL_MaterialService.GetSteelList(); this.ddlSTE1.DataBind(); Funs.FineUIPleaseSelect(this.ddlSTE1); ///材质2 this.ddlSTE2.DataTextField = "STE_Code"; this.ddlSTE2.DataValueField = "STE_ID"; this.ddlSTE2.DataSource = BLL.HJGL_MaterialService.GetSteelList(); this.ddlSTE2.DataBind(); Funs.FineUIPleaseSelect(this.ddlSTE2); ///焊缝类型 this.ddlJOTY_ID.DataTextField = "JOTY_Name"; this.ddlJOTY_ID.DataValueField = "JOTY_ID"; this.ddlJOTY_ID.DataSource = BLL.HJGL_WeldService.GetJointTypeNameList("2"); this.ddlJOTY_ID.DataBind(); Funs.FineUIPleaseSelect(this.ddlJOTY_ID); ///坡口类型 this.ddlJST_ID.DataTextField = "JST_Name"; this.ddlJST_ID.DataValueField = "JST_ID"; this.ddlJST_ID.DataSource = BLL.HJGL_GrooveService.GetSlopeTypeNameList(); this.ddlJST_ID.DataBind(); Funs.FineUIPleaseSelect(this.ddlJST_ID); ///焊口属性 this.ddlJointAttribute.DataTextField = "Text"; this.ddlJointAttribute.DataValueField = "Value"; this.ddlJointAttribute.DataSource = BLL.DropListService.HJGL_JointAttributeItem(); this.ddlJointAttribute.DataBind(); Funs.FineUIPleaseSelect(this.ddlJointAttribute); ///焊接方法 this.ddlWME_ID.DataTextField = "WME_Name"; this.ddlWME_ID.DataValueField = "WME_ID"; this.ddlWME_ID.DataSource = BLL.HJGL_WeldingMethodService.GetWeldMethodNameList(); this.ddlWME_ID.DataBind(); Funs.FineUIPleaseSelect(this.ddlWME_ID); ///焊接区域 this.ddlWLO_CODE.DataTextField = "Text"; this.ddlWLO_CODE.DataValueField = "Value"; this.ddlWLO_CODE.DataSource = BLL.DropListService.HJGL_WLO_CODEItem(); this.ddlWLO_CODE.DataBind(); Funs.FineUIPleaseSelect(this.ddlWLO_CODE); 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.drpNDTR_ID.DataTextField = "NDTR_Name"; this.drpNDTR_ID.DataValueField = "NDTR_ID"; this.drpNDTR_ID.DataSource = BLL.HJGL_DetectionService.GetNDTRateNameList(); this.drpNDTR_ID.DataBind(); Funs.FineUIPleaseSelect(this.drpNDTR_ID); //合格等级 this.drpJOT_QualifiedLevel.DataTextField = "Text"; this.drpJOT_QualifiedLevel.DataValueField = "Value"; this.drpJOT_QualifiedLevel.DataSource = BLL.DropListService.HJGL_NDTClassItem(); this.drpJOT_QualifiedLevel.DataBind(); Funs.FineUIPleaseSelect(this.drpJOT_QualifiedLevel); ///焊丝 this.ddlWeldSilk.DataTextField = "WMT_MatCode"; this.ddlWeldSilk.DataValueField = "WMT_ID"; this.ddlWeldSilk.DataSource = BLL.HJGL_ConsumablesService.GetMaterialList("1"); this.ddlWeldSilk.DataBind(); Funs.FineUIPleaseSelect(this.ddlWeldSilk); ///焊条 this.ddlWeldMat.DataTextField = "WMT_MatCode"; this.ddlWeldMat.DataValueField = "WMT_ID"; this.ddlWeldMat.DataSource = BLL.HJGL_ConsumablesService.GetMaterialList("2"); this.ddlWeldMat.DataBind(); Funs.FineUIPleaseSelect(this.ddlWeldMat); } #endregion #region 加载页面显示信息 /// /// 加载页面显示信息 /// private void LoadShowInfo() { string jotIdStr = Request.Params["jotIdList"]; if (!string.IsNullOrEmpty(jotIdStr)) { var jotIdList= jotIdStr.Split(','); txtJointNoS.Text=BLL.HJGL_PW_JointInfoService.ConvertJointCodeString(jotIdStr); var jointInfo = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(jotIdList[0]); this.ISO_ID = jointInfo.ISO_ID; if (jointInfo != null) { this.txtJointDesc.Text = jointInfo.JOT_JointDesc; if (!string.IsNullOrEmpty(jointInfo.DReportID)) { this.drpNDTR_ID.Enabled = false; } if (!string.IsNullOrEmpty(jointInfo.STE_ID)) { this.ddlSTE1.SelectedValue = jointInfo.STE_ID; var ste = BLL.HJGL_MaterialService.GetSteelBySteID(jointInfo.STE_ID); if (ste != null) { this.txtHardQuaStandard.Text = ste.HardQuaStandard; } } if (!string.IsNullOrEmpty(jointInfo.STE_ID2)) { this.ddlSTE2.SelectedValue = jointInfo.STE_ID2; } if (!string.IsNullOrEmpty(jointInfo.JOTY_ID)) { this.ddlJOTY_ID.SelectedValue = jointInfo.JOTY_ID; } if (!string.IsNullOrEmpty(jointInfo.JST_ID)) { this.ddlJST_ID.SelectedValue = jointInfo.JST_ID; } if (!string.IsNullOrEmpty(jointInfo.JOT_JointAttribute)) { this.ddlJointAttribute.SelectedValue = jointInfo.JOT_JointAttribute; } if (!string.IsNullOrEmpty(jointInfo.WME_ID)) { this.ddlWME_ID.SelectedValue = jointInfo.WME_ID; } this.txtSize.Text = Convert.ToString(jointInfo.JOT_Size); this.txtSch.Text = jointInfo.JOT_Sch; if (jointInfo.JOT_Dia != null) { this.txtDia.Text = Convert.ToString(jointInfo.JOT_Dia); } //this.txtFactSch.Text = Convert.ToString(jointInfo.JOT_FactSch); if (!string.IsNullOrEmpty(jointInfo.WLO_Code)) { this.ddlWLO_CODE.SelectedValue = jointInfo.WLO_Code; } this.txtLastTemp.Text = Convert.ToString(jointInfo.JOT_LastTemp); this.txtCellTemp.Text = Convert.ToString(jointInfo.JOT_CellTemp); this.txtPrepareTemp.Text = Convert.ToString(jointInfo.JOT_PrepareTemp); if (!string.IsNullOrEmpty(jointInfo.JOT_WeldSilk)) { this.ddlWeldSilk.SelectedValue = jointInfo.JOT_WeldSilk; } if (jointInfo.WeldL != null) { this.txtWeldL.Text = jointInfo.WeldL.ToString(); } if (!string.IsNullOrEmpty(jointInfo.JOT_WeldMat)) { this.ddlWeldMat.SelectedValue = jointInfo.JOT_WeldMat; } this.txtElectricity.Text = jointInfo.JOT_Electricity; if (!string.IsNullOrEmpty(jointInfo.IS_Proess)) { this.drpIS_Proess.SelectedValue = jointInfo.IS_Proess; if (jointInfo.IS_Proess == "1") { this.drpProessTypes.Hidden = false; //this.lbl.Hidden = true; if (!string.IsNullOrEmpty(jointInfo.ProessTypes)) { string[] proessTypes = jointInfo.ProessTypes.Split('|'); this.drpProessTypes.Values = proessTypes; } } } if (jointInfo.IsSpecial == true) { this.drpIsSpecial.SelectedValue = "1"; } else { this.drpIsSpecial.SelectedValue = "0"; } if (!string.IsNullOrEmpty(jointInfo.InstallationId)) { this.drpInstallationId.SelectedValue = jointInfo.InstallationId; } if (!string.IsNullOrEmpty(jointInfo.NDTR_ID)) { this.drpNDTR_ID.SelectedValue = jointInfo.NDTR_ID; } if (!string.IsNullOrEmpty(jointInfo.JOT_QualifiedLevel)) { this.drpJOT_QualifiedLevel.SelectedValue = jointInfo.JOT_QualifiedLevel; } this.txtPressureTestPackageNo.Text = jointInfo.PressureTestPackageNo; } } } #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 (this.drpInstallationId.SelectedValue == BLL.Const._Null) { Alert.ShowInTop("请选择装置", MessageBoxIcon.Warning); return; } if (this.ddlSTE1.SelectedValue == BLL.Const._Null) { Alert.ShowInTop("请选择材质1", MessageBoxIcon.Warning); return; } if (this.ddlJOTY_ID.SelectedValue == BLL.Const._Null) { Alert.ShowInTop("请选择焊缝类型!", MessageBoxIcon.Warning); return; } if (this.ddlJST_ID.SelectedValue == BLL.Const._Null) { Alert.ShowInTop("请选择坡口类型!", MessageBoxIcon.Warning); return; } if (this.ddlJointAttribute.SelectedValue == BLL.Const._Null) { Alert.ShowInTop("请选择焊口属性!", MessageBoxIcon.Warning); return; } if (this.ddlWME_ID.SelectedValue == BLL.Const._Null) { Alert.ShowInTop("请选择焊接方法!", MessageBoxIcon.Warning); return; } string jotIdStr = Request.Params["jotIdList"]; if (!string.IsNullOrEmpty(jotIdStr)) { Model.SGGLDB db = Funs.DB; var jotIdList = jotIdStr.Split(','); foreach (var jotId in jotIdList) { Model.HJGL_PW_JointInfo newJointInfo = db.HJGL_PW_JointInfo.FirstOrDefault(x => x.JOT_ID == jotId); var hotItems = from x in BLL.Funs.DB.HJGL_CH_HotProessTrustItem where x.JOT_ID == jotId select x; var batchDetail = BLL.HJGL_BO_BatchDetailService.GetBatchDetailByJotId(jotId); if ((batchDetail != null || hotItems.Count() > 0) && this.CurrUser.UserId != BLL.Const.GlyId) { newJointInfo.JOT_PrepareTemp = Funs.GetNewDecimal(this.txtPrepareTemp.Text); newJointInfo.PressureTestPackageNo = this.txtPressureTestPackageNo.Text; if (this.drpIS_Proess.SelectedValue != BLL.Const._Null) { newJointInfo.IS_Proess = this.drpIS_Proess.SelectedValue; if (this.drpIS_Proess.SelectedValue == "1") { if (drpProessTypes.Values.Length > 0) { newJointInfo.ProessTypes = String.Join("|", drpProessTypes.Values); } else { Alert.ShowInTop("请选择热处理类型!", MessageBoxIcon.Warning); return; } } } BLL.HJGL_PW_JointInfoService.UpdateJointInfo(newJointInfo); } else { newJointInfo.JOT_JointDesc = this.txtJointDesc.Text.Trim(); if (this.ddlSTE1.SelectedValue != BLL.Const._Null) { newJointInfo.STE_ID = this.ddlSTE1.SelectedValue; } if (this.ddlSTE2.SelectedValue != BLL.Const._Null) { newJointInfo.STE_ID2 = this.ddlSTE2.SelectedValue; } if (this.ddlJOTY_ID.SelectedValue != BLL.Const._Null) { newJointInfo.JOTY_ID = this.ddlJOTY_ID.SelectedValue; } if (this.ddlJST_ID.SelectedValue != BLL.Const._Null) { newJointInfo.JST_ID = this.ddlJST_ID.SelectedValue; } if (this.ddlJointAttribute.SelectedValue != BLL.Const._Null) { newJointInfo.JOT_JointAttribute = this.ddlJointAttribute.SelectedValue; } if (this.ddlWME_ID.SelectedValue != BLL.Const._Null) { newJointInfo.WME_ID = this.ddlWME_ID.SelectedValue; } if (this.drpInstallationId.SelectedValue != BLL.Const._Null) { newJointInfo.InstallationId = this.drpInstallationId.SelectedValue; } newJointInfo.JOT_Size = Funs.GetNewDecimal(this.txtSize.Text); newJointInfo.JOT_Dia = Funs.GetNewDecimal(this.txtDia.Text); newJointInfo.JOT_Sch = this.txtSch.Text.Trim(); newJointInfo.JOT_TrustFlag = "00"; newJointInfo.JOT_CheckFlag = "00"; newJointInfo.JOT_JointStatus = "100"; if (this.ddlWLO_CODE.SelectedValue != BLL.Const._Null) { newJointInfo.WLO_Code = this.ddlWLO_CODE.SelectedValue; } if (this.drpNDTR_ID.SelectedValue != BLL.Const._Null) { if (string.IsNullOrEmpty(newJointInfo.DReportID)) { newJointInfo.NDTR_ID = this.drpNDTR_ID.SelectedValue; } } if (this.drpJOT_QualifiedLevel.SelectedValue != BLL.Const._Null) { newJointInfo.JOT_QualifiedLevel = this.drpJOT_QualifiedLevel.SelectedValue; } newJointInfo.JOT_LastTemp = Funs.GetNewDecimal(this.txtLastTemp.Text); newJointInfo.JOT_CellTemp = Funs.GetNewDecimal(this.txtCellTemp.Text); newJointInfo.JOT_PrepareTemp = Funs.GetNewDecimal(this.txtPrepareTemp.Text); newJointInfo.JOT_Electricity = this.txtElectricity.Text.Trim(); newJointInfo.PressureTestPackageNo = this.txtPressureTestPackageNo.Text; if (this.drpIsSpecial.SelectedValue == "1") { newJointInfo.IsSpecial = true; } else { newJointInfo.IsSpecial = false; } if (this.drpIS_Proess.SelectedValue != BLL.Const._Null) { newJointInfo.IS_Proess = this.drpIS_Proess.SelectedValue; if (this.drpIS_Proess.SelectedValue == "1") { if (drpProessTypes.Values.Length > 0) { newJointInfo.ProessTypes = String.Join("|", drpProessTypes.Values); } else { Alert.ShowInTop("请选择热处理类型!", MessageBoxIcon.Warning); return; } } } if (this.ddlWeldSilk.SelectedValue != BLL.Const._Null) { newJointInfo.JOT_WeldSilk = this.ddlWeldSilk.SelectedValue; } if (this.ddlWeldMat.SelectedValue != BLL.Const._Null) { newJointInfo.JOT_WeldMat = this.ddlWeldMat.SelectedValue; } if (!string.IsNullOrEmpty(this.txtWeldL.Text)) { newJointInfo.WeldL = Convert.ToInt32(this.txtWeldL.Text); } if (newJointInfo.DReportID != null) { BLL.HJGL_PW_JointInfoService.UpdateJointNoAddG(jotId, this.ddlJointAttribute.SelectedValue, Const.BtnModify); } BLL.HJGL_PW_JointInfoService.UpdateJointInfo(newJointInfo); } } } PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); ShowNotify("提交成功!", MessageBoxIcon.Success); } else { Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); return; } } #endregion #region 根据寸经外径对照表,输入外径是自动得到寸径;焊口规格:Φ外径*壁厚 /// /// 根据寸经外径对照表,输入外径是自动得到寸径;焊口规格:Φ外径*壁厚 /// /// /// protected void txtText_TextChanged(object sender, EventArgs e) { //根据寸经外径对照表,输入外径是自动得到寸径 if (!string.IsNullOrEmpty(this.txtDia.Text.Trim())) { decimal dia = Funs.GetNewDecimalOrZero(this.txtDia.Text.Trim()); if (dia >= 500) { this.drpIsSpecial.SelectedValue = "1"; } var inch = HJGL_ControlService.GetSizeByDia(dia); if (inch != null) { this.txtSize.Text = Convert.ToString(inch); } } //焊口规格:Φ外径*壁厚 if (!string.IsNullOrEmpty(this.txtDia.Text.Trim()) && !string.IsNullOrEmpty(this.txtSch.Text.Trim())) { this.txtJointDesc.Text = "Φ" + this.txtDia.Text.Trim() + "×" + this.txtSch.Text.Trim(); } } // 非常规焊缝 protected void txtWeldL_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtWeldL.Text.Trim())) { this.txtJointDesc.Text = "L=" + this.txtWeldL.Text.Trim() + "×" + this.txtSch.Text.Trim(); } } #endregion #region DropDownList下拉选择事件 /// /// 焊缝类型下拉选择事件 /// /// /// protected void ddlJOTY_ID_SelectedIndexChanged(object sender, EventArgs e) { if (this.ddlJOTY_ID.SelectedValue != BLL.Const._Null) { var joty = BLL.HJGL_WeldService.GetJointTypeByID(this.ddlJOTY_ID.SelectedValue); if (joty != null) { var isoInfo = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(this.ISO_ID); if (isoInfo != null) { if (!string.IsNullOrEmpty(isoInfo.ISC_ID) && !string.IsNullOrEmpty(isoInfo.ISO_Executive)) { var weldControl = BLL.HJGL_WeldControlService.GEtWeldControlByISCIDAndExecStandardId(isoInfo.ISC_ID, isoInfo.ISO_Executive); if (weldControl != null) { if (joty.JOTY_Group == "1") { this.drpNDTR_ID.SelectedValue = weldControl.Joty_Rate; this.drpJOT_QualifiedLevel.SelectedValue = weldControl.Joty_Level; } else if (joty.JOTY_Group == "2") { this.drpNDTR_ID.SelectedValue = weldControl.Joty_C_Rate; this.drpJOT_QualifiedLevel.SelectedValue = weldControl.Joty_C_Level; } else if (joty.JOTY_Group == "3") { this.drpNDTR_ID.SelectedValue = weldControl.Joty_D_Rate; this.drpJOT_QualifiedLevel.SelectedValue = weldControl.Joty_D_Level; } else { this.drpNDTR_ID.SelectedValue = BLL.Const._Null; this.drpJOT_QualifiedLevel.SelectedValue = BLL.Const._Null; } } else { this.drpNDTR_ID.SelectedValue = BLL.Const._Null; this.drpJOT_QualifiedLevel.SelectedValue = BLL.Const._Null; } } } } else { this.drpNDTR_ID.SelectedValue = BLL.Const._Null; this.drpJOT_QualifiedLevel.SelectedValue = BLL.Const._Null; } } else { this.drpNDTR_ID.SelectedValue = BLL.Const._Null; this.drpJOT_QualifiedLevel.SelectedValue = BLL.Const._Null; } } /// /// 材质1下拉选择事件 /// /// /// protected void ddlSTE1_SelectedIndexChanged(object sender, EventArgs e) { if (this.ddlSTE1.SelectedValue != BLL.Const._Null) { var ste = BLL.HJGL_MaterialService.GetSteelBySteID(this.ddlSTE1.SelectedValue); if (ste != null) { this.txtHardQuaStandard.Text = ste.HardQuaStandard; } else { this.txtHardQuaStandard.Text = string.Empty; } this.ddlSTE2.SelectedValue = ddlSTE1.SelectedValue; } else { this.txtHardQuaStandard.Text = string.Empty; } } /// /// 是否显示热处理类型 /// /// /// protected void drpIS_Proess_SelectedIndexChanged(object sender, EventArgs e) { if (this.drpIS_Proess.SelectedValue == "1") { this.drpProessTypes.Hidden = false; } else { this.drpProessTypes.Hidden = true; } } #endregion } }