Basf_TCC11/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/JointInfoBatchEdit.aspx.cs

521 lines
22 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Linq;
using BLL;
namespace FineUIPro.Web.WeldingProcess.WeldingManage
{
public partial class JointInfoBatchEdit : PageBase
{
#region
/// <summary>
/// 管线主键
/// </summary>
private string PipelineId
{
get
{
return (string)ViewState["PipelineId"];
}
set
{
ViewState["PipelineId"] = value;
}
}
/// <summary>
/// 项目主键
/// </summary>
private string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.PipelineId = Request.Params["PipelineId"];
///初始化下拉框
this.LoadDropDownList();
///初始化显示信息
this.LoadShowInfo();
}
}
#endregion
#region
#region
/// <summary>
/// 加载下拉框
/// </summary>
private void LoadDropDownList()
{
///材质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);
///焊口属性
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);
///焊接方法
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_ConsumablesService.InitConsumablesDropDownList(this.drpWeldSilk, true, "1",Resources.Lan.PleaseSelect);
///焊条
Base_ConsumablesService.InitConsumablesDropDownList(this.drpWeldMat, true, "2", Resources.Lan.PleaseSelect);
Base_DNCompareService.InitDNCompareDropDownList(this.drpANSISCH, true);
///焊接位置
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);
}
#endregion
#region
/// <summary>
/// 加载页面显示信息
/// </summary>
private void LoadShowInfo()
{
///加载管线、区域、装置、单位
var pipeline = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(this.PipelineId);
if (pipeline != null)
{
this.ProjectId = pipeline.ProjectId;
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;
}
}
}
}
#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, BLL.Const.HJGL_JointInfoMenuId, BLL.Const.BtnSave))
{
if (string.IsNullOrEmpty(this.txtSpecification.Text.Trim()) || 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()) || drpGrooveType.SelectedValue == BLL.Const._Null
|| drpNDTType.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;
}
}
int startInt = Funs.GetNewIntOrZero(this.txtWeldJointCode1.Text.Trim());
int endInt = Funs.GetNewIntOrZero(this.txtWeldJointCode2.Text.Trim());
if (endInt < startInt)
{
Alert.ShowInTop(Resources.Lan.StopBigStart, 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();
newJointInfo.Specification = this.txtSpecification.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.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;
//}
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.Size = Funs.GetNewDecimal(this.txtSize.Text);
newJointInfo.Dia = Funs.GetNewDecimal(this.txtDia.Text);
newJointInfo.Thickness = Funs.GetNewDecimal(this.txtThickness.Text);
newJointInfo.PipingClassId = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(this.PipelineId).PipingClassId;
if (this.drpGrooveType.SelectedValue != BLL.Const._Null)
{
newJointInfo.GrooveTypeId = this.drpGrooveType.SelectedValue;
}
if (this.drpJointAttribute.SelectedValue != BLL.Const._Null)
{
newJointInfo.JointAttribute = this.drpJointAttribute.SelectedValue;
}
if (this.drpWeldingMethod.SelectedValue != BLL.Const._Null)
{
newJointInfo.WeldingMethodId = this.drpWeldingMethod.SelectedValue;
}
if (this.drpWeldSilk.SelectedValue != BLL.Const._Null)
{
newJointInfo.WeldSilkId = string.Join(",", drpWeldSilk.SelectedValueArray);
//newJointInfo.WeldSilkId = this.drpWeldSilk.SelectedValue;
}
if (this.drpWeldMat.SelectedValue != BLL.Const._Null)
{
newJointInfo.WeldMatId = this.drpWeldMat.SelectedValue;
}
if (this.drpWeldingLocation.SelectedValue != BLL.Const._Null)
{
newJointInfo.WeldingLocationId = this.drpWeldingLocation.SelectedValue;
}
if (this.drpIsHotProess.SelectedValue != BLL.Const._Null)
{
newJointInfo.IsHotProess = Convert.ToBoolean(this.drpIsHotProess.SelectedValue);
}
newJointInfo.WPQId = drpWPS.SelectedValue;
newJointInfo.DetectionType = string.Join("|", drpNDTType.SelectedValueArray);
for (int i = startInt; i <= endInt; i++)
{
newJointInfo.WeldJointCode = this.txtWeldJointCode.Text.Trim() + Convert.ToString(i);
//if (i < 10)
//{
// newJointInfo.WeldJointCode = this.txtWeldJointCode.Text.Trim() + "0" + Convert.ToString(i);
//}
//else
//{
// newJointInfo.WeldJointCode = this.txtWeldJointCode.Text.Trim() + Convert.ToString(i);
//}
if (!BLL.Pipeline_WeldJointService.IsExistWeldJointCode(this.txtWeldJointCode.Text.Trim(), this.PipelineId, string.Empty))
{
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);
}
}
Alert.ShowInTop(Resources.Lan.SaveSuccessfully, MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
}
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);
}
#region
/// <summary>
/// 选择外径和壁厚自动获取规格
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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;
}
}
}
}
/// <summary>
/// 选择外径和壁厚自动获取规格
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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
}
}