265 lines
11 KiB
C#
265 lines
11 KiB
C#
|
using BLL;
|
|||
|
using Model;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
using System.Web.UI;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
|
|||
|
namespace FineUIPro.Web.YLRQ.ConstructionManagement
|
|||
|
{
|
|||
|
public partial class WeldingManagementEdit : PageBase
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 主键
|
|||
|
/// </summary>
|
|||
|
private string WeldingId
|
|||
|
{
|
|||
|
get { return (string)ViewState["WeldingId"]; }
|
|||
|
set { ViewState["WeldingId"] = value; }
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 项目主键
|
|||
|
/// </summary>
|
|||
|
private string ProjectId
|
|||
|
{
|
|||
|
get { return (string)ViewState["ProjectId"]; }
|
|||
|
set { ViewState["ProjectId"] = value; }
|
|||
|
}
|
|||
|
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
this.WeldingId = Request.Params["WeldingId"];
|
|||
|
this.ProjectId = Request.Params["ProjectId"];
|
|||
|
LoadData();
|
|||
|
if (!string.IsNullOrEmpty(this.WeldingId))
|
|||
|
{
|
|||
|
var weldInfo = Funs.DB.PV_WeldInformation.FirstOrDefault(p => p.WeldingId == this.WeldingId);
|
|||
|
if (weldInfo != null)
|
|||
|
{
|
|||
|
LoadShowInfo(weldInfo);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 首次加载绑定
|
|||
|
/// </summary>
|
|||
|
public void LoadData()
|
|||
|
{
|
|||
|
//材质1
|
|||
|
this.ddlTextureMaterial1.DataTextField = "STE_Code";
|
|||
|
this.ddlTextureMaterial1.DataValueField = "STE_ID";
|
|||
|
this.ddlTextureMaterial1.DataSource = BLL.HJGL_MaterialService.GetSteelList();
|
|||
|
this.ddlTextureMaterial1.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.ddlTextureMaterial1);
|
|||
|
|
|||
|
//材质2
|
|||
|
this.ddlTextureMaterial2.DataTextField = "STE_Code";
|
|||
|
this.ddlTextureMaterial2.DataValueField = "STE_ID";
|
|||
|
this.ddlTextureMaterial2.DataSource = BLL.HJGL_MaterialService.GetSteelList();
|
|||
|
this.ddlTextureMaterial2.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.ddlTextureMaterial2);
|
|||
|
|
|||
|
//坡口类型
|
|||
|
this.ddlGrooveType.DataTextField = "JST_Name";
|
|||
|
this.ddlGrooveType.DataValueField = "JST_ID";
|
|||
|
this.ddlGrooveType.DataSource = BLL.HJGL_GrooveService.GetSlopeTypeNameList();
|
|||
|
this.ddlGrooveType.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.ddlGrooveType);
|
|||
|
|
|||
|
//创建人
|
|||
|
this.drpCreate.DataTextField = "UserName";
|
|||
|
this.drpCreate.DataValueField = "UserId";
|
|||
|
this.drpCreate.DataSource = BLL.Sys_UserService.GetUserList();
|
|||
|
this.drpCreate.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.drpCreate);
|
|||
|
this.drpCreate.SelectedValue = this.CurrUser.UserId;
|
|||
|
|
|||
|
//施工单位
|
|||
|
this.ddlUnit.DataTextField = "UnitName";
|
|||
|
this.ddlUnit.DataValueField = "UnitId";
|
|||
|
this.ddlUnit.DataSource = Funs.DB.View_Common_Project_UnitList.Where(p => p.ProjectId == this.ProjectId && p.UnitType.Contains("4")).ToList();
|
|||
|
this.ddlUnit.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.ddlUnit);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 绑定数据
|
|||
|
/// </summary>
|
|||
|
public void LoadShowInfo(PV_WeldInformation woldInfo)
|
|||
|
{
|
|||
|
txtWeldingCode.Text = woldInfo.WeldingCode;
|
|||
|
ddlTextureMaterial1.SelectedValue = woldInfo.TextureMaterial1;
|
|||
|
ddlTextureMaterial2.SelectedValue = woldInfo.TextureMaterial2;
|
|||
|
txtWeldLength.Text = woldInfo.WeldLength;
|
|||
|
ddlWeldUnit.SelectedValue = woldInfo.WeldUnit != null ? woldInfo.WeldUnit.ToString() : "1";
|
|||
|
ddlGrooveType.SelectedValue = woldInfo.GrooveType;
|
|||
|
txtThickness.Text = woldInfo.Thickness;
|
|||
|
ddlUnit.SelectedValue = woldInfo.UnitId;
|
|||
|
if (!string.IsNullOrEmpty(woldInfo.HeatTreatmentType))
|
|||
|
{
|
|||
|
string[] proessTypes = woldInfo.HeatTreatmentType.Split('|');
|
|||
|
this.ddlHeatTreatmentType.Values = proessTypes;
|
|||
|
}
|
|||
|
var ste = BLL.HJGL_MaterialService.GetSteelBySteID(woldInfo.TextureMaterial1);
|
|||
|
if (ste != null)
|
|||
|
{
|
|||
|
this.txtHardQuaStandard.Text = ste.HardQuaStandard;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 提交
|
|||
|
/// </summary>
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (this.ddlTextureMaterial1.SelectedValue == BLL.Const._Null)
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择材质1!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.ddlTextureMaterial2.SelectedValue == BLL.Const._Null)
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择材质2!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.ddlGrooveType.SelectedValue == BLL.Const._Null)
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择坡口类型!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.ddlUnit.SelectedValue == BLL.Const._Null)
|
|||
|
{
|
|||
|
Alert.ShowInTop("请选择施工单位!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
//if (Funs.DB.HJGL_PW_JointInfo.Count(p => p.JOT_JointNo == txtWeldingCode.Text.Trim()) > 0)
|
|||
|
//{
|
|||
|
// Alert.ShowInTop("焊缝编号在管道安装中已存在!", MessageBoxIcon.Warning);
|
|||
|
// return;
|
|||
|
//}
|
|||
|
PV_WeldInformation woldInfo = new PV_WeldInformation();
|
|||
|
if (!string.IsNullOrEmpty(this.WeldingId))
|
|||
|
{
|
|||
|
woldInfo = Funs.DB.PV_WeldInformation.FirstOrDefault(p => p.WeldingId == WeldingId);
|
|||
|
if (woldInfo == null)
|
|||
|
{
|
|||
|
Alert.ShowInTop("传递主键存在异常!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (Funs.DB.PV_WeldInformation.Count(p => p.WeldingCode == txtWeldingCode.Text && p.WeldingId != this.WeldingId && p.ProjectId == this.ProjectId) > 0)
|
|||
|
{
|
|||
|
Alert.ShowInTop("焊缝编号已存在!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (Funs.DB.PV_WeldInformation.Count(p => p.WeldingCode == txtWeldingCode.Text && p.ProjectId == this.ProjectId) > 0)
|
|||
|
{
|
|||
|
Alert.ShowInTop("焊缝编号已存在!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
woldInfo.ProjectId = this.ProjectId;
|
|||
|
woldInfo.WeldingCode = txtWeldingCode.Text;
|
|||
|
woldInfo.TextureMaterial1 = ddlTextureMaterial1.SelectedValue;
|
|||
|
woldInfo.TextureMaterial2 = ddlTextureMaterial2.SelectedValue;
|
|||
|
woldInfo.WeldLength = txtWeldLength.Text;
|
|||
|
woldInfo.WeldUnit = int.Parse(ddlWeldUnit.SelectedValue);
|
|||
|
woldInfo.GrooveType = ddlGrooveType.SelectedValue;
|
|||
|
woldInfo.Thickness = txtThickness.Text;
|
|||
|
woldInfo.HeatTreatmentType = ddlHeatTreatmentType.Values.Length > 0 ? string.Join("|", ddlHeatTreatmentType.Values) : null;
|
|||
|
woldInfo.CreateId = drpCreate.SelectedValue;
|
|||
|
woldInfo.CreateTime = DateTime.Now;
|
|||
|
woldInfo.UnitId = ddlUnit.SelectedValue;
|
|||
|
if (ddlWeldUnit.SelectedValue == "1")
|
|||
|
{
|
|||
|
woldInfo.JointDesc = $"{woldInfo.WeldLength}x{woldInfo.Thickness}";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
woldInfo.JointDesc = $"Φ{woldInfo.WeldLength}x{woldInfo.Thickness}";
|
|||
|
}
|
|||
|
if (string.IsNullOrEmpty(this.WeldingId))
|
|||
|
{
|
|||
|
woldInfo.WeldingId = Guid.NewGuid().ToString();
|
|||
|
Funs.DB.PV_WeldInformation.InsertOnSubmit(woldInfo);
|
|||
|
BLL.Sys_LogService.AddLog(BLL.Const.System_4, this.CurrUser.Account, this.CurrUser.UserId, "添加焊缝信息!");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
BLL.Sys_LogService.AddLog(BLL.Const.System_4, this.CurrUser.Account, this.CurrUser.UserId, "修改焊缝信息!");
|
|||
|
}
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
Alert.ShowInTop(ex.Message, MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 引用
|
|||
|
/// </summary>
|
|||
|
protected void btnCopy_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
var woldInfo = Funs.DB.PV_WeldInformation.FirstOrDefault(p => p.WeldingCode == txtWeldingCodeS.Text.Trim());
|
|||
|
if (woldInfo != null)
|
|||
|
{
|
|||
|
ddlTextureMaterial1.SelectedValue = woldInfo.TextureMaterial1;
|
|||
|
ddlTextureMaterial2.SelectedValue = woldInfo.TextureMaterial2;
|
|||
|
txtWeldLength.Text = woldInfo.WeldLength;
|
|||
|
ddlWeldUnit.SelectedValue = woldInfo.WeldUnit != null ? woldInfo.WeldUnit.ToString() : "1";
|
|||
|
ddlGrooveType.SelectedValue = woldInfo.GrooveType;
|
|||
|
txtThickness.Text = woldInfo.Thickness;
|
|||
|
ddlUnit.SelectedValue = woldInfo.UnitId;
|
|||
|
if (!string.IsNullOrEmpty(woldInfo.HeatTreatmentType))
|
|||
|
{
|
|||
|
string[] proessTypes = woldInfo.HeatTreatmentType.Split('|');
|
|||
|
this.ddlHeatTreatmentType.Values = proessTypes;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 材质1
|
|||
|
/// </summary>
|
|||
|
protected void ddlTextureMaterial1_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (this.ddlTextureMaterial1.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
ddlTextureMaterial2.SelectedValue = ddlTextureMaterial1.SelectedValue;
|
|||
|
var ste = BLL.HJGL_MaterialService.GetSteelBySteID(this.ddlTextureMaterial1.SelectedValue);
|
|||
|
if (ste != null)
|
|||
|
{
|
|||
|
this.txtHardQuaStandard.Text = ste.HardQuaStandard;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.txtHardQuaStandard.Text = string.Empty;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.txtHardQuaStandard.Text = string.Empty;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|