295 lines
12 KiB
C#
295 lines
12 KiB
C#
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);
|
|
|
|
///坡口类型
|
|
Base_GrooveTypeService.InitGrooveTypeDropDownList(this.drpGrooveType, true, Resources.Lan.PleaseSelect);
|
|
|
|
///焊口属性
|
|
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_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);
|
|
}
|
|
#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()))
|
|
{
|
|
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;
|
|
}
|
|
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.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 = this.drpWeldSilk.SelectedValue;
|
|
}
|
|
if (this.drpWeldMat.SelectedValue != BLL.Const._Null)
|
|
{
|
|
newJointInfo.WeldMatId = this.drpWeldMat.SelectedValue;
|
|
}
|
|
if (drpGrooveType.SelectedValue != BLL.Const._Null)
|
|
{
|
|
newJointInfo.GrooveTypeId = drpGrooveType.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);
|
|
}
|
|
for (int i = startInt; i <= endInt; 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
|
|
|
|
#region 外径、壁厚输入框事件
|
|
/// <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
|
|
}
|
|
} |