namespace FineUIPro.Web.HJGL.WeldingManage { using System; using BLL; using System.Linq; using System.Collections.Generic; using System.Web.UI.WebControls; using System.Web.UI; public partial class JointInfoEdit : PageBase { #region 定义项 /// /// 管线主键 /// private string ISO_ID { get { return (string)ViewState["ISO_ID"]; } set { ViewState["ISO_ID"] = value; } } /// /// 区域信息主键 /// public string JOT_ID { get { return (string)ViewState["JOT_ID"]; } set { ViewState["JOT_ID"] = value; } } #endregion #region 加载页面 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.JOT_ID = Request.Params["JOT_ID"]; this.ISO_ID = Request.Params["ISO_ID"]; ///初始化下拉框 this.LoadDropDownList(); var jointInfo = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(this.JOT_ID); if (jointInfo != null) { this.ISO_ID = jointInfo.ISO_ID; // 初始化显示信息 this.LoadShowInfo(jointInfo); } // 初始化页面信息 this.LoadPageInfo(jointInfo); } } #endregion #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); ///组件1号 this.ddlComponent1.DataTextField = "COM_Name"; this.ddlComponent1.DataValueField = "COM_ID"; this.ddlComponent1.DataSource = BLL.HJGL_ComponentsService.GetComponentNameList(); this.ddlComponent1.DataBind(); Funs.FineUIPleaseSelect(this.ddlComponent1); ///组件2号 this.ddlComponent2.DataTextField = "COM_Name"; this.ddlComponent2.DataValueField = "COM_ID"; this.ddlComponent2.DataSource = BLL.HJGL_ComponentsService.GetComponentNameList(); this.ddlComponent2.DataBind(); Funs.FineUIPleaseSelect(this.ddlComponent2); ///焊丝 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); ///是否热处理 //this.drpIS_Proess.DataTextField = "Text"; //this.drpIS_Proess.DataValueField = "Value"; //this.drpIS_Proess.DataSource = BLL.DropListService.IsTrueOrFalseDrpList(); //this.drpIS_Proess.DataBind(); //Funs.FineUIPleaseSelect(this.drpIS_Proess); List myList = new List(); myList = BLL.HJGL_PW_JointInfoService.GetProessTypes(); RadioButtonList1.DataTextField = "Name"; RadioButtonList1.DataValueField = "Id"; RadioButtonList1.DataSource = myList; RadioButtonList1.DataBind(); 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); } #endregion #region 加载页面显示信息 /// /// 加载页面显示信息 /// private void LoadShowInfo(Model.HJGL_PW_JointInfo jointInfo) { this.txtReport.Text = "未焊接"; this.txtPoint.Text = "未点口"; this.ddlTrustFlag.Text = "未委托"; this.ddlCheckFlag.Text = "未检测"; if (!string.IsNullOrEmpty(this.JOT_ID)) { var hotItems = from x in BLL.Funs.DB.HJGL_CH_HotProessTrustItem where x.JOT_ID == JOT_ID select x; var batchDetail = BLL.HJGL_BO_BatchDetailService.GetBatchDetailByJotId(JOT_ID); if ((batchDetail != null || hotItems.Count() > 0) && this.CurrUser.UserId != BLL.Const.GlyId) { this.TextIsReadOnly(true); if (batchDetail != null) { var batch = BLL.HJGL_BO_BatchService.GetBatchById(batchDetail.BatchId); if (batch.BatchIsClosed == true) { btnCopy.Enabled = false; // 不能引用 } } //if (this.CurrUser.UserId != BLL.Const.GlyId) //焊接或热处理委托后非管理员不能修改焊口信息数据 //{ // this.TextIsReadOnly(true); //} } if (hotItems.Count() > 0) { drpIS_Proess.Enabled = false; //drpProessTypes.Enabled = false; } else { drpIS_Proess.Enabled = true; //drpProessTypes.Enabled = true; } //热处理后只能增加热处理类型,或者去除还未委托的热处理类型 } if (jointInfo != null) { if (!string.IsNullOrEmpty(jointInfo.DReportID)) { this.txtReport.Text = "已焊接"; var dReport = BLL.HJGL_WeldReportService.GetWeldReportByDReportID(jointInfo.DReportID); if (dReport != null) { this.ddlReportCode.Text = dReport.JOT_DailyReportNo; if (jointInfo.Jot_WeldingDate.HasValue) { this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", jointInfo.Jot_WeldingDate); } else { this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", dReport.JOT_WeldDate); } if (!String.IsNullOrEmpty(jointInfo.JOT_FloorWelder)) { var floorWelder = BLL.HJGL_PersonManageService.GetWelderByWenId(jointInfo.JOT_FloorWelder); if (floorWelder != null) { this.txtFloorWelder.Text = floorWelder.WED_Code; this.txtFloorWelderName.Text = floorWelder.WED_Name; } } if (!String.IsNullOrEmpty(jointInfo.JOT_CellWelder)) { var cellWelder = BLL.HJGL_PersonManageService.GetWelderByWenId(jointInfo.JOT_CellWelder); if (cellWelder != null) { this.txtCellWelder.Text = cellWelder.WED_Code; this.txtCellWelderName.Text = cellWelder.WED_Name; } } this.txtDoneDia.Text = Convert.ToString(jointInfo.JOT_DoneDin); } } ///焊口状态 var jointStatus = BLL.HJGL_BO_BatchDetailService.GetBatchDetailByJotId(jointInfo.JOT_ID); if (jointStatus != null && jointStatus.PointType != null) { if (jointStatus.PointType == "1") { this.ddlJointStatus.Text = "点口"; } if (jointStatus.PointType == "2") { this.ddlJointStatus.Text = "扩透"; } if (jointStatus.PointType == "3") { this.ddlJointStatus.Text = "切除"; } this.txtPoint.Text = "已点口"; } var trustFlag = from x in Funs.DB.HJGL_CH_TrustItem where x.JOT_ID == jointInfo.JOT_ID select x; ///委托状态 if (trustFlag.Count() > 0) { this.ddlTrustFlag.Text = "已委托"; } ///探伤标志 if (trustFlag.Count() > 0 && trustFlag.First().States == "2") { this.ddlCheckFlag.Text = "已检测"; } } ///加载管线、区域、装置、单位 var isoInfo = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(this.ISO_ID); if (isoInfo != null) { this.txtISONO.Text = isoInfo.ISO_IsoNo; var installation = BLL.Project_InstallationService.GetInstallationByInstallationId(jointInfo.InstallationId); if (installation != null) { this.lbInstallationName.Text = installation.InstallationName; } var unit = BLL.Base_UnitService.GetUnit(isoInfo.BSU_ID); if (unit != null) { this.lbUnitName.Text = unit.UnitName; } } } #endregion #region 初始化页面信息 /// /// 初始化页面信息 /// protected void LoadPageInfo(Model.HJGL_PW_JointInfo jointInfo) { if (jointInfo != null) { this.txtJointNo.Text = jointInfo.JOT_JointNo; 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.txtDial.Text = (jointInfo.JOT_Dia ?? 0).ToString("N2"); this.txtSch.Text = jointInfo.JOT_Sch; //this.txtFactSch.Text = Convert.ToString(jointInfo.JOT_FactSch); if (!string.IsNullOrEmpty(jointInfo.WLO_Code)) { this.ddlWLO_CODE.SelectedValue = jointInfo.WLO_Code; } //this.txtBelongPipe.Text = jointInfo.JOT_BelongPipe; if (!string.IsNullOrEmpty(jointInfo.JOT_Component1)) { this.ddlComponent1.SelectedValue = jointInfo.JOT_Component1; } if (!string.IsNullOrEmpty(jointInfo.JOT_Component2)) { this.ddlComponent2.SelectedValue = jointInfo.JOT_Component2; } //this.txtHeartNo1.Text = jointInfo.JOT_HeartNo1; //this.txtHeartNo2.Text = jointInfo.JOT_HeartNo2; 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; this.txtVoltage.Text = jointInfo.JOT_Voltage; //this.txtComponentNum.Text = jointInfo.ComponentNum; 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"; } this.txtRemark.Text = jointInfo.JOT_Remark; 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; } else { //根据管线自动加载材质1、材质2 var iso = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(this.ISO_ID); if (iso != null) { if (!string.IsNullOrEmpty(iso.STE_ID)) { this.ddlSTE1.SelectedValue = iso.STE_ID; this.ddlSTE2.SelectedValue = iso.STE_ID; if (this.ddlSTE1.SelectedValue != BLL.Const._Null) { var ste = BLL.HJGL_MaterialService.GetSteelBySteID(this.ddlSTE1.SelectedValue); if (ste != null) { this.txtHardQuaStandard.Text = ste.HardQuaStandard; } } } if (!string.IsNullOrEmpty(iso.IsHot)) { this.drpIS_Proess.SelectedValue = iso.IsHot; if (this.drpIS_Proess.SelectedValue == "1") { this.drpProessTypes.Hidden = false; //this.lbl.Hidden = true; if (!string.IsNullOrEmpty(iso.IsHotType)) { string[] proessTypes = iso.IsHotType.Split('|'); this.drpProessTypes.Values = proessTypes; } } } if (!string.IsNullOrEmpty(iso.PressureTestPackageNo)) { txtPressureTestPackageNo.Text = iso.PressureTestPackageNo; } } } } #endregion #region 文本框是否可编辑 /// /// 文本框是否可编辑 /// /// private void TextIsReadOnly(bool readOnly) { //this.btnSave.Hidden = readOnly; this.txtJointNo.Readonly = readOnly; this.ddlWLO_CODE.Enabled = !readOnly; this.ddlSTE1.Enabled = !readOnly; this.ddlSTE2.Enabled = !readOnly; this.ddlComponent1.Enabled = !readOnly; this.ddlComponent2.Enabled = !readOnly; this.txtJointDesc.Readonly = readOnly; this.ddlJOTY_ID.Enabled = !readOnly; this.txtSize.Readonly = readOnly; this.txtDial.Readonly = readOnly; this.ddlJST_ID.Enabled = !readOnly; this.txtSch.Readonly = readOnly; this.txtLastTemp.Readonly = readOnly; this.txtCellTemp.Readonly = readOnly; //this.txtPrepareTemp.Readonly = readOnly; this.ddlJointAttribute.Enabled = !readOnly; this.ddlWME_ID.Enabled = !readOnly; this.ddlWeldSilk.Enabled = !readOnly; this.ddlWeldMat.Enabled = !readOnly; this.txtElectricity.Readonly = readOnly; this.txtVoltage.Readonly = readOnly; this.txtRemark.Readonly = readOnly; this.drpInstallationId.Enabled = !readOnly; this.drpNDTR_ID.Enabled = !readOnly; this.drpJOT_QualifiedLevel.Enabled = !readOnly; this.drpIsSpecial.Enabled = !readOnly; this.txtHardQuaStandard.Readonly = readOnly; this.txtWeldL.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 (BLL.HJGL_PW_JointInfoService.IsExistJointInfoCode(this.CurrUser.LoginProjectId,this.txtJointNo.Text.Trim(), this.ISO_ID, this.JOT_ID)) { Alert.ShowInTop("该管线焊口号已存在!", MessageBoxIcon.Warning); return; } Model.HJGL_PW_JointInfo newJointInfo = new Model.HJGL_PW_JointInfo(); newJointInfo.ProjectId = this.CurrUser.LoginProjectId; newJointInfo.ISO_ID = this.ISO_ID; newJointInfo.JOT_JointNo = this.txtJointNo.Text.Trim(); newJointInfo.JOT_JointDesc = this.txtJointDesc.Text.Trim(); if (this.ddlSTE1.SelectedValue != BLL.Const._Null) { newJointInfo.STE_ID = this.ddlSTE1.SelectedValue; } else { Alert.ShowInTop("请选择材质1!", MessageBoxIcon.Warning); return; } 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; } else { Alert.ShowInTop("请选择焊缝类型!", MessageBoxIcon.Warning); return; } if (this.ddlJST_ID.SelectedValue != BLL.Const._Null) { newJointInfo.JST_ID = this.ddlJST_ID.SelectedValue; } else { Alert.ShowInTop("请选择坡口类型!", MessageBoxIcon.Warning); return; } if (this.ddlJointAttribute.SelectedValue != BLL.Const._Null) { newJointInfo.JOT_JointAttribute = this.ddlJointAttribute.SelectedValue; } else { Alert.ShowInTop("请选择焊口属性!", MessageBoxIcon.Warning); return; } if (this.ddlWME_ID.SelectedValue != BLL.Const._Null) { newJointInfo.WME_ID = this.ddlWME_ID.SelectedValue; } else { Alert.ShowInTop("请选择焊接方法!", MessageBoxIcon.Warning); return; } newJointInfo.JOT_Size = Funs.GetNewDecimal(this.txtSize.Text); newJointInfo.JOT_Dia = Funs.GetNewDecimal(this.txtDial.Text); newJointInfo.JOT_Sch = this.txtSch.Text.Trim(); if (this.ddlWLO_CODE.SelectedValue != BLL.Const._Null) { newJointInfo.WLO_Code = this.ddlWLO_CODE.SelectedValue; } if (this.ddlComponent1.SelectedValue != BLL.Const._Null) { newJointInfo.JOT_Component1 = this.ddlComponent1.SelectedValue; } if (this.ddlComponent2.SelectedValue != BLL.Const._Null) { newJointInfo.JOT_Component2 = this.ddlComponent2.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); 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; } newJointInfo.JOT_Electricity = this.txtElectricity.Text.Trim(); newJointInfo.JOT_Voltage = this.txtVoltage.Text.Trim(); 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; } } } newJointInfo.JOT_Remark = this.txtRemark.Text; newJointInfo.PressureTestPackageNo = this.txtPressureTestPackageNo.Text; if (this.drpInstallationId.SelectedValue != BLL.Const._Null) { newJointInfo.InstallationId = this.drpInstallationId.SelectedValue; } else { Alert.ShowInTop("请选择装置!", MessageBoxIcon.Warning); return; } if (this.drpNDTR_ID.SelectedValue != BLL.Const._Null) { newJointInfo.NDTR_ID = this.drpNDTR_ID.SelectedValue; } else { Alert.ShowInTop("请选择探伤类型!", MessageBoxIcon.Warning); return; } if (this.drpJOT_QualifiedLevel.SelectedValue != BLL.Const._Null) { newJointInfo.JOT_QualifiedLevel = this.drpJOT_QualifiedLevel.SelectedValue; } else { Alert.ShowInTop("请选择合格等级!", MessageBoxIcon.Warning); return; } if (this.drpIsSpecial.SelectedValue == "1") { newJointInfo.IsSpecial = true; } else { newJointInfo.IsSpecial = false; } if (!string.IsNullOrEmpty(this.txtWeldL.Text)) { newJointInfo.WeldL = Convert.ToInt32(this.txtWeldL.Text); } if (string.IsNullOrEmpty(this.JOT_ID)) { try { newJointInfo.JOT_ID = SQLHelper.GetNewID(typeof(Model.HJGL_PW_JointInfo)); this.JOT_ID = newJointInfo.JOT_ID; BLL.HJGL_PW_JointInfoService.AddJointInfo(newJointInfo); BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加焊口信息!"); } catch { } } else { var jot = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(this.JOT_ID); List hotProessTrustItems = BLL.HJGL_CH_HotProessTrustService.GetCH_HotProessTrustItemByJOT_ID(this.JOT_ID); var batch = (from x in Funs.DB.HJGL_BO_Batch join y in Funs.DB.HJGL_BO_BatchDetail on x.BatchId equals y.BatchId where y.JOT_ID == this.JOT_ID select x).FirstOrDefault(); newJointInfo.JOT_Location = jot.JOT_Location; bool batchIsClosed = false; if (batch != null && batch.BatchIsClosed == true) { batchIsClosed = true; } if (hotProessTrustItems.Count > 0 || batchIsClosed) //存在热处理委托或者批关闭则不能修改焊口号 { if (newJointInfo.JOT_JointNo != jot.JOT_JointNo) { Alert.ShowInTop("热处理已委托或者批关闭,不能修改焊口号!", MessageBoxIcon.Warning); return; } } newJointInfo.JOT_ID = this.JOT_ID; newJointInfo.DReportID = jot.DReportID; newJointInfo.JOT_CellWelder = jot.JOT_CellWelder; newJointInfo.JOT_FloorWelder = jot.JOT_FloorWelder; if (this.txtDoneDia.Text != string.Empty) { newJointInfo.JOT_DoneDin = Convert.ToDecimal(this.txtDoneDia.Text); } try { BLL.HJGL_PW_JointInfoService.UpdateJointInfo(newJointInfo); } catch { } if (jot.DReportID != null) { BLL.HJGL_PW_JointInfoService.UpdateJointNoAddG(this.JOT_ID, this.ddlJointAttribute.SelectedValue, Const.Add); } BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改焊口信息!"); } // 更新排序字段 string strSort = @"UPDATE dbo.HJGL_PW_JointInfo SET Sort1=(case when PATINDEX('[A-Z]%',JOT_JointNo)>0 THEN 'B' WHEN ISNUMERIC(JOT_JointNo)=1 then 'C' ELSE 'C' END), Sort2=(CASE WHEN ISNUMERIC(JOT_JointNo)=1 then try_cast(REPLACE(JOT_JointNo,'.','') AS INT) WHEN ISNUMERIC(SUBSTRING(JOT_JointNo,0,CHARINDEX('Z',JOT_JointNo)))=1 THEN TRY_CAST(SUBSTRING(JOT_JointNo,0,CHARINDEX('Z',JOT_JointNo)) as int) WHEN PATINDEX('[0-9]%',JOT_JointNo)>0 then TRY_CAST(left(JOT_JointNo,PATINDEX('%[^0-9]%',JOT_JointNo)-1) as int) ELSE 0 END), Sort3= SUBSTRING(JOT_JointNo,1,1), Sort4=(CASE WHEN CHARINDEX('Z',JOT_JointNo)>0 and SUBSTRING(JOT_JointNo,1,1)<>'Z' THEN ISNULL(TRY_CAST(SUBSTRING(replace(JOT_JointNo,'#',''),2,CHARINDEX('Z',JOT_JointNo)-2) as int),0) WHEN PATINDEX('%[A-G]%',SUBSTRING(replace(JOT_JointNo,'#',''),2,len(JOT_JointNo)))>0 THEN ISNULL(TRY_CAST(SUBSTRING(JOT_JointNo,2,len(JOT_JointNo)-2) as int),0) ELSE ISNULL(TRY_CAST(SUBSTRING(replace(JOT_JointNo,'#',''),2,len(JOT_JointNo)) as int),0) END), Sort5=(CASE WHEN CHARINDEX('Z',JOT_JointNo)>0 THEN ISNULL(TRY_CAST(SUBSTRING(JOT_JointNo,charindex('Z',JOT_JointNo)+1,len(JOT_JointNo)) AS INT),0) WHEN PATINDEX('%[A-Y]',SUBSTRING(replace(JOT_JointNo,'#',''),2,len(JOT_JointNo)))>0 THEN ISNULL(TRY_CAST(SUBSTRING(JOT_JointNo,2,len(JOT_JointNo)-1) as int),0) ELSE 0 END) WHERE JOT_ID='"+ this.JOT_ID + "'"; SQLHelper.ExecutSql(strSort); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); ShowNotify("提交成功!", MessageBoxIcon.Success); } else { Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); return; } } #endregion #region DropDownList下拉选择事件 /// /// 是否显示热处理类型 /// /// /// protected void drpIS_Proess_SelectedIndexChanged(object sender, EventArgs e) { if (this.drpIS_Proess.SelectedValue == "1") { this.drpProessTypes.Hidden = false; } else { this.drpProessTypes.Hidden = true; } } /// /// 热处理类型选择变化事件 /// /// /// protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e) { //已委托的热处理类型 var isTrustProessTypes = from x in BLL.Funs.DB.HJGL_CH_HotProessTrustItem where x.JOT_ID == JOT_ID select x.ProessTypes; if (drpProessTypes.Values.Length > 0) { List strs = this.RadioButtonList1.SelectedValueArray.ToList(); foreach (var isTrustProessType in isTrustProessTypes) //已委托的热处理类型不能去除 { if (!strs.Contains(isTrustProessType)) { strs.Add(isTrustProessType); } } this.RadioButtonList1.SelectedValueArray = strs.ToArray(); this.drpProessTypes.Values = strs.ToArray(); string proessTypes = String.Join("|", drpProessTypes.Values); this.drpProessTypes.Text = BLL.HJGL_PW_JointInfoService.ConvertProessTypes(proessTypes); } else { Alert.ShowInTop("请选择热处理类型!", MessageBoxIcon.Warning); return; } } /// /// 焊缝类型下拉选择事件 /// /// /// 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 (joty.JOTY_Group == "1") { this.drpNDTR_ID.SelectedValue = isoInfo.Joty_B_Rate; this.drpJOT_QualifiedLevel.SelectedValue = isoInfo.Joty_B_Level; } else if (joty.JOTY_Group == "2") { this.drpNDTR_ID.SelectedValue = isoInfo.Joty_C_Rate; this.drpJOT_QualifiedLevel.SelectedValue = isoInfo.Joty_C_Level; } else if (joty.JOTY_Group == "3") { this.drpNDTR_ID.SelectedValue = isoInfo.Joty_D_Rate; this.drpJOT_QualifiedLevel.SelectedValue = isoInfo.Joty_D_Level; } } } else { this.drpNDTR_ID.SelectedValue = BLL.Const._Null; this.drpJOT_QualifiedLevel.Text = BLL.Const._Null; } } else { this.drpNDTR_ID.SelectedValue = BLL.Const._Null; this.drpJOT_QualifiedLevel.Text = 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; } } #endregion #region 引用 /// /// 引用 /// /// /// protected void btnCopy_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtJointNoS.Text.Trim()) && !string.IsNullOrEmpty(this.ISO_ID)) { var jointInfo = BLL.HJGL_PW_JointInfoService.GetJointInfoByJointNoAndIsoId(this.txtJointNoS.Text.Trim(), this.ISO_ID, this.CurrUser.LoginProjectId); if (jointInfo != null) { //this.txtJointNo.Text = jointInfo.JOT_JointNo; this.txtJointDesc.Text = jointInfo.JOT_JointDesc; 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.txtDial.Text = Convert.ToString(jointInfo.JOT_Dia); this.txtSch.Text = jointInfo.JOT_Sch; if (!string.IsNullOrEmpty(jointInfo.WLO_Code)) { this.ddlWLO_CODE.SelectedValue = jointInfo.WLO_Code; } if (!string.IsNullOrEmpty(jointInfo.JOT_Component1)) { this.ddlComponent1.SelectedValue = jointInfo.JOT_Component1; } if (!string.IsNullOrEmpty(jointInfo.JOT_Component2)) { this.ddlComponent2.SelectedValue = jointInfo.JOT_Component2; } 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 (!string.IsNullOrEmpty(jointInfo.JOT_WeldMat)) { this.ddlWeldMat.SelectedValue = jointInfo.JOT_WeldMat; } this.txtElectricity.Text = jointInfo.JOT_Electricity; this.txtVoltage.Text = jointInfo.JOT_Voltage; if (!string.IsNullOrEmpty(jointInfo.IS_Proess)) { this.drpIS_Proess.SelectedValue = jointInfo.IS_Proess; if (jointInfo.IS_Proess == "1") { this.drpProessTypes.Hidden = false; if (!string.IsNullOrEmpty(jointInfo.ProessTypes)) { string[] proessTypes = jointInfo.ProessTypes.Split('|'); this.drpProessTypes.Values = proessTypes; } } } if (jointInfo.WeldL != null) { this.txtWeldL.Text = jointInfo.WeldL.ToString(); } this.txtRemark.Text = jointInfo.JOT_Remark; 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; } if (jointInfo.IsSpecial == true) { this.drpIsSpecial.SelectedValue = "1"; } else { this.drpIsSpecial.SelectedValue = "0"; } this.txtPressureTestPackageNo.Text = jointInfo.PressureTestPackageNo; } } } #endregion #region 根据寸经外径对照表,输入外径是自动得到寸径;焊口规格:Φ外径*壁厚 /// /// 根据寸经外径对照表,输入外径是自动得到寸径;焊口规格:Φ外径*壁厚 /// /// /// protected void txtText_TextChanged(object sender, EventArgs e) { //根据寸经外径对照表,输入外径是自动得到寸径 if (!string.IsNullOrEmpty(this.txtDial.Text.Trim())) { decimal dia = Funs.GetNewDecimalOrZero(this.txtDial.Text.Trim()); if (dia >= 500) { this.drpIsSpecial.SelectedValue = "1"; } //else //{ // this.drpIsSpecial.SelectedValue = "0"; //} var inch = HJGL_ControlService.GetSizeByDia(dia); if (inch != null) { this.txtSize.Text = Convert.ToString(inch); } } //焊口规格:Φ外径*壁厚 if (!string.IsNullOrEmpty(this.txtDial.Text.Trim()) && !string.IsNullOrEmpty(this.txtSch.Text.Trim())) { this.txtJointDesc.Text = "Φ" + this.txtDial.Text.Trim() + "×" + this.txtSch.Text.Trim(); } } protected void txtDial_TextChanged(object sender, EventArgs e) { //根据寸经外径对照表,输入外径是自动得到寸径 if (!string.IsNullOrEmpty(this.txtDial.Text.Trim())) { decimal dia = Funs.GetNewDecimalOrZero(this.txtDial.Text.Trim()); if (dia >= 500) { this.drpIsSpecial.SelectedValue = "1"; } //else //{ // this.drpIsSpecial.SelectedValue = "0"; //} var inch = HJGL_ControlService.GetSizeByDia(dia); if (inch != null) { this.txtSize.Text = Convert.ToString(inch); } } //焊口规格:Φ外径*壁厚 if (!string.IsNullOrEmpty(this.txtDial.Text.Trim()) && !string.IsNullOrEmpty(this.txtSch.Text.Trim())) { this.txtJointDesc.Text = "Φ" + this.txtDial.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 } }