351 lines
17 KiB
C#
351 lines
17 KiB
C#
using System;
|
||
using BLL;
|
||
|
||
namespace FineUIPro.Web.HJGLServer.WeldingManage
|
||
{
|
||
public partial class WeldingProcedureEdit :PageBase
|
||
{
|
||
#region 定义项
|
||
/// <summary>
|
||
/// 主键
|
||
/// </summary>
|
||
private string WeldingProcedureId
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["WeldingProcedureId"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["WeldingProcedureId"] = value;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 加载
|
||
/// <summary>
|
||
/// 加载页面
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||
this.drpSteel1.DataTextField = "STE_Name";
|
||
this.drpSteel1.DataValueField = "STE_ID";
|
||
this.drpSteel1.DataSource = BLL.HJGL_MaterialService.GetSteelList();
|
||
this.drpSteel1.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpSteel1);
|
||
this.drpSteel2.DataTextField = "STE_Name";
|
||
this.drpSteel2.DataValueField = "STE_ID";
|
||
this.drpSteel2.DataSource = BLL.HJGL_MaterialService.GetSteelList();
|
||
this.drpSteel2.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpSteel2);
|
||
this.drpWeldingMethodId.DataTextField = "WME_Name";
|
||
this.drpWeldingMethodId.DataValueField = "WME_ID";
|
||
this.drpWeldingMethodId.DataSource = HJGL_WeldingMethodService.GetWeldMethodNameList();
|
||
this.drpWeldingMethodId.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpWeldingMethodId);
|
||
this.drpStandardId.DataTextField = "StandardCode";
|
||
this.drpStandardId.DataValueField = "StandardId";
|
||
this.drpStandardId.DataSource = BLL.HJGL_StandardService.GetStandardList();
|
||
this.drpStandardId.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpStandardId);
|
||
|
||
this.WeldingProcedureId = Request.Params["WeldingProcedureId"];
|
||
if (!string.IsNullOrEmpty(this.WeldingProcedureId))
|
||
{
|
||
Model.HJGL_WeldingProcedure_WeldingProcedure weldingProcedure = BLL.HJGL_WeldingManage_WeldingProcedureService.GetWeldingProcedureById(this.WeldingProcedureId);
|
||
if (weldingProcedure!=null)
|
||
{
|
||
this.txtWeldingProcedureCode.Text = weldingProcedure.WeldingProcedureCode;
|
||
if (weldingProcedure.CompileDate!=null)
|
||
{
|
||
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", weldingProcedure.CompileDate);
|
||
}
|
||
if (!string.IsNullOrEmpty(weldingProcedure.STE_ID1))
|
||
{
|
||
this.drpSteel1.SelectedValue = weldingProcedure.STE_ID1;
|
||
var steel1 = BLL.HJGL_MaterialService.GetSteelBySteID(weldingProcedure.STE_ID1);
|
||
if (steel1!=null)
|
||
{
|
||
if (!string.IsNullOrEmpty(steel1.MaterialType))
|
||
{
|
||
var materialClass = BLL.HJGL_MaterialClassService.GetMaterialClassById(steel1.MaterialType);
|
||
if (materialClass!=null)
|
||
{
|
||
this.txtMaterialClass1.Text = materialClass.MaterialClass;
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(steel1.MaterialGroup))
|
||
{
|
||
var materialGroup = BLL.HJGL_MaterialGroupService.GetMaterialGroupById(steel1.MaterialGroup);
|
||
if (materialGroup!=null)
|
||
{
|
||
this.txtMaterialGroup1.Text = materialGroup.MaterialGroup;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(weldingProcedure.STE_ID2))
|
||
{
|
||
this.drpSteel2.SelectedValue = weldingProcedure.STE_ID2;
|
||
var steel2 = BLL.HJGL_MaterialService.GetSteelBySteID(weldingProcedure.STE_ID2);
|
||
if (steel2 != null)
|
||
{
|
||
if (!string.IsNullOrEmpty(steel2.MaterialType))
|
||
{
|
||
var materialClass = BLL.HJGL_MaterialClassService.GetMaterialClassById(steel2.MaterialType);
|
||
if (materialClass != null)
|
||
{
|
||
this.txtMaterialClass2.Text = materialClass.MaterialClass;
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(steel2.MaterialGroup))
|
||
{
|
||
var materialGroup = BLL.HJGL_MaterialGroupService.GetMaterialGroupById(steel2.MaterialGroup);
|
||
if (materialGroup != null)
|
||
{
|
||
this.txtMaterialGroup2.Text = materialGroup.MaterialGroup;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
this.txtSpecifications.Text = weldingProcedure.Specifications;
|
||
this.txtWeldingModel.Text = weldingProcedure.WeldingModel;
|
||
this.txtWeldingGrade.Text = weldingProcedure.WeldingGrade;
|
||
this.txtWeldingSpecifications.Text = weldingProcedure.WeldingSpecifications;
|
||
this.txtWeldingPosition.Text = weldingProcedure.WeldingPosition;
|
||
if (!string.IsNullOrEmpty(weldingProcedure.WeldingMethodId))
|
||
{
|
||
this.drpWeldingMethodId.SelectedValue = weldingProcedure.WeldingMethodId;
|
||
}
|
||
if (weldingProcedure.MinImpactDia != null)
|
||
{
|
||
this.txtMinImpactDia.Text = Convert.ToString(weldingProcedure.MinImpactDia);
|
||
}
|
||
if (weldingProcedure.MaxImpactDia!=null)
|
||
{
|
||
this.txtMaxImpactDia.Text = Convert.ToString(weldingProcedure.MaxImpactDia);
|
||
}
|
||
if (weldingProcedure.MinImpactThickness!=null)
|
||
{
|
||
this.txtMinImpactThickness.Text = Convert.ToString(weldingProcedure.MinImpactThickness);
|
||
}
|
||
if (weldingProcedure.MaxImpactThickness!=null)
|
||
{
|
||
this.txtMaxImpactThickness.Text = Convert.ToString(weldingProcedure.MaxImpactThickness);
|
||
}
|
||
if (weldingProcedure.NoMinImpactThickness!=null)
|
||
{
|
||
this.txtNoMinImpactThickness.Text = Convert.ToString(weldingProcedure.NoMinImpactThickness);
|
||
}
|
||
if (weldingProcedure.NoMaxImpactThickness!=null)
|
||
{
|
||
this.txtNoMaxImpactThickness.Text = Convert.ToString(weldingProcedure.NoMaxImpactThickness);
|
||
}
|
||
if (!string.IsNullOrEmpty(weldingProcedure.StandardId))
|
||
{
|
||
this.drpStandardId.SelectedValue = weldingProcedure.StandardId;
|
||
}
|
||
if (weldingProcedure.IsHotTreatment==true)
|
||
{
|
||
this.cbkIsHotTreatment.Checked = true;
|
||
}
|
||
else
|
||
{
|
||
this.cbkIsHotTreatment.Checked = false;
|
||
}
|
||
this.txtRemark.Text = weldingProcedure.Remark;
|
||
this.txtJointType.Text = weldingProcedure.JointType;
|
||
this.txtMotorization.Text = weldingProcedure.Motorization;
|
||
this.txtProtectiveGas.Text = weldingProcedure.ProtectiveGas;
|
||
this.txtStretching.Text = weldingProcedure.Stretching;
|
||
this.txtBend.Text = weldingProcedure.Bend;
|
||
this.txtToAttack.Text = weldingProcedure.ToAttack;
|
||
this.txtOthers.Text = weldingProcedure.Others;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 提交
|
||
/// <summary>
|
||
/// 提交按钮
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnSave_Click(object sender, EventArgs e)
|
||
{
|
||
if (this.drpSteel1.SelectedValue == BLL.Const._Null)
|
||
{
|
||
Alert.ShowInTop("材质1不能为空!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
SaveData();
|
||
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||
}
|
||
|
||
/// <summary>
|
||
/// 提交数据
|
||
/// </summary>
|
||
private void SaveData()
|
||
{
|
||
Model.HJGL_WeldingProcedure_WeldingProcedure weldingProcedure = new Model.HJGL_WeldingProcedure_WeldingProcedure();
|
||
weldingProcedure.WeldingProcedureCode = this.txtWeldingProcedureCode.Text.Trim();
|
||
weldingProcedure.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text.Trim());
|
||
if (this.drpSteel1.SelectedValue != BLL.Const._Null)
|
||
{
|
||
weldingProcedure.STE_ID1 = this.drpSteel1.SelectedValue;
|
||
}
|
||
if (this.drpSteel2.SelectedValue != BLL.Const._Null)
|
||
{
|
||
weldingProcedure.STE_ID2 = this.drpSteel2.SelectedValue;
|
||
}
|
||
weldingProcedure.Specifications = this.txtSpecifications.Text.Trim();
|
||
weldingProcedure.WeldingModel = this.txtWeldingModel.Text.Trim();
|
||
weldingProcedure.WeldingGrade = this.txtWeldingGrade.Text.Trim();
|
||
weldingProcedure.WeldingSpecifications = this.txtWeldingSpecifications.Text.Trim();
|
||
weldingProcedure.WeldingPosition = this.txtWeldingPosition.Text.Trim();
|
||
if (this.drpWeldingMethodId.SelectedValue != BLL.Const._Null)
|
||
{
|
||
weldingProcedure.WeldingMethodId = this.drpWeldingMethodId.SelectedValue;
|
||
}
|
||
weldingProcedure.Remark = this.txtRemark.Text.Trim();
|
||
weldingProcedure.MinImpactThickness = Funs.GetNewDecimal(this.txtMinImpactThickness.Text.Trim());
|
||
weldingProcedure.MaxImpactThickness = Funs.GetNewDecimal(this.txtMaxImpactThickness.Text.Trim());
|
||
weldingProcedure.NoMinImpactThickness = Funs.GetNewDecimal(this.txtNoMinImpactThickness.Text.Trim());
|
||
weldingProcedure.NoMaxImpactThickness = Funs.GetNewDecimal(this.txtNoMaxImpactThickness.Text.Trim());
|
||
if (this.cbkIsHotTreatment.Checked == true)
|
||
{
|
||
weldingProcedure.IsHotTreatment = true;
|
||
}
|
||
else
|
||
{
|
||
weldingProcedure.IsHotTreatment = false;
|
||
}
|
||
weldingProcedure.MinImpactDia = Funs.GetNewDecimal(this.txtMinImpactDia.Text.Trim());
|
||
weldingProcedure.MaxImpactDia = Funs.GetNewDecimal(this.txtMaxImpactDia.Text.Trim());
|
||
if (this.drpStandardId.SelectedValue != BLL.Const._Null)
|
||
{
|
||
weldingProcedure.StandardId = this.drpStandardId.SelectedValue;
|
||
}
|
||
weldingProcedure.JointType = this.txtJointType.Text.Trim();
|
||
weldingProcedure.Motorization = this.txtMotorization.Text.Trim();
|
||
weldingProcedure.ProtectiveGas = this.txtProtectiveGas.Text.Trim();
|
||
weldingProcedure.Stretching = this.txtStretching.Text.Trim();
|
||
weldingProcedure.Bend = this.txtBend.Text.Trim();
|
||
weldingProcedure.ToAttack = this.txtToAttack.Text.Trim();
|
||
weldingProcedure.Others = this.txtOthers.Text.Trim();
|
||
if (!string.IsNullOrEmpty(this.WeldingProcedureId))
|
||
{
|
||
weldingProcedure.WeldingProcedureId = this.WeldingProcedureId;
|
||
BLL.HJGL_WeldingManage_WeldingProcedureService.UpdateWeldingProcedure(weldingProcedure);
|
||
BLL.Sys_LogService.AddLog(Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改焊接工艺评定台账");
|
||
}
|
||
else
|
||
{
|
||
this.WeldingProcedureId = SQLHelper.GetNewID(typeof(Model.HJGL_WeldingProcedure_WeldingProcedure));
|
||
weldingProcedure.WeldingProcedureId = this.WeldingProcedureId;
|
||
BLL.HJGL_WeldingManage_WeldingProcedureService.AddWeldingProcedure(weldingProcedure);
|
||
BLL.Sys_LogService.AddLog(Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加焊接工艺评定台账");
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 附件上传
|
||
/// <summary>
|
||
/// 上传附件资源
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
||
{
|
||
string edit = "0"; // 表示能打开附件上传窗口,但不能上传附件
|
||
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_WeldingProcedureMenuId, BLL.Const.BtnSave))
|
||
{
|
||
if (string.IsNullOrEmpty(this.WeldingProcedureId))
|
||
{
|
||
SaveData();
|
||
}
|
||
edit = "1";
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/HJGLServer/WeldingManage&menuId={1}&edit={2}", this.WeldingProcedureId, Const.HJGL_WeldingProcedureMenuId, edit)));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region DropDownList下拉选择事件
|
||
/// <summary>
|
||
/// 材质1下拉列表选择事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void drpSteel1_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
if (this.drpSteel1.SelectedValue != BLL.Const._Null)
|
||
{
|
||
var steel1 = BLL.HJGL_MaterialService.GetSteelBySteID(this.drpSteel1.SelectedValue);
|
||
if (steel1!=null)
|
||
{
|
||
if (!string.IsNullOrEmpty(steel1.MaterialType))
|
||
{
|
||
var materialClass = BLL.HJGL_MaterialClassService.GetMaterialClassById(steel1.MaterialType);
|
||
if (materialClass!=null)
|
||
{
|
||
this.txtMaterialClass1.Text = materialClass.MaterialClass;
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(steel1.MaterialGroup))
|
||
{
|
||
var materialGroup = BLL.HJGL_MaterialGroupService.GetMaterialGroupById(steel1.MaterialGroup);
|
||
if (materialGroup!=null)
|
||
{
|
||
this.txtMaterialGroup1.Text = materialGroup.MaterialGroup;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 材质2下拉列表选择事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void drpSteel2_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
if (this.drpSteel2.SelectedValue != BLL.Const._Null)
|
||
{
|
||
var steel2 = BLL.HJGL_MaterialService.GetSteelBySteID(this.drpSteel2.SelectedValue);
|
||
if (steel2 != null)
|
||
{
|
||
if (!string.IsNullOrEmpty(steel2.MaterialType))
|
||
{
|
||
var materialClass = BLL.HJGL_MaterialClassService.GetMaterialClassById(steel2.MaterialType);
|
||
if (materialClass != null)
|
||
{
|
||
this.txtMaterialClass2.Text = materialClass.MaterialClass;
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(steel2.MaterialGroup))
|
||
{
|
||
var materialGroup = BLL.HJGL_MaterialGroupService.GetMaterialGroupById(steel2.MaterialGroup);
|
||
if (materialGroup != null)
|
||
{
|
||
this.txtMaterialGroup2.Text = materialGroup.MaterialGroup;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
} |