Files
HJGL_DS/HJGL_DS/FineUIPro.Web/JGZL/TeamWeldingInspectionEdit.aspx.cs
T
2026-01-08 15:27:09 +08:00

202 lines
9.9 KiB
C#

using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.JGZL
{
public partial class TeamWeldingInspectionEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string TeamWeldingInspectionItemId
{
get
{
return (string)ViewState["TeamWeldingInspectionItemId"];
}
set
{
ViewState["TeamWeldingInspectionItemId"] = value;
}
}
/// <summary>
/// 项目Id
/// </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.ProjectId = Request.Params["projectId"];
this.TeamWeldingInspectionItemId = Request.Params["teamWeldingInspectionItemId"];
if (!string.IsNullOrEmpty(this.TeamWeldingInspectionItemId))
{
var item = BLL.TeamWeldingInspectionItemService.GetTeamWeldingInspectionItemById(this.TeamWeldingInspectionItemId);
if (item != null)
{
var report = BLL.TeamWeldingInspectionService.GetTeamWeldingInspectionById(item.TeamWeldingInspectionId);
if (report != null)
{
this.ProjectId = report.ProjectId;
this.drpPipeline.DataTextField = "ISO_IsoNo";
this.drpPipeline.DataValueField = "ISO_ID";
this.drpPipeline.DataSource = (from x in Funs.DB.HJGL_PW_IsoInfo where x.ProjectId == this.ProjectId orderby x.ISO_IsoNo select x).ToList();
this.drpPipeline.DataBind();
Funs.FineUIPleaseSelect(this.drpPipeline);
this.txtUsingUnitTeam.Text = report.UsingUnitTeam;
this.txtInstallationArea.Text = report.InstallationArea;
}
txtCheckDate.Text = item.CheckDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.CheckDate) : "";
txtMaterial.Text = item.Material;
if (!string.IsNullOrEmpty(item.PipelineNo))
{
this.drpPipeline.SelectedValue = item.PipelineNo;
this.drpWeldingJoint.DataTextField = "JOT_JointNo";
this.drpWeldingJoint.DataValueField = "JOT_ID";
this.drpWeldingJoint.DataSource = (from x in Funs.DB.HJGL_PW_JointInfo where x.ISO_ID == this.drpPipeline.SelectedValue select x).ToList().OrderBy(x=>x.Sort1).OrderBy(x => x.Sort2).OrderBy(x => x.Sort3).OrderBy(x => x.Sort4).OrderBy(x => x.Sort5);
this.drpWeldingJoint.DataBind();
Funs.FineUIPleaseSelect(this.drpWeldingJoint);
}
if (!string.IsNullOrEmpty(item.WeldingJointNo))
{
this.drpWeldingJoint.SelectedValue = item.WeldingJointNo;
}
rblInstallationMethod.SelectedValue = item.InstallationMethod;
txtWeldingWire.Text = item.WeldingWire;
txtWeldingRod.Text = item.WeldingRod;
txtTeamGap.Text = item.TeamGap;
txtTeamPlumber.Text = item.TeamPlumber;
txtTeamWelder.Text = item.TeamWelder;
txtTeamInspector.Text = item.TeamInspector;
txtGTAWWelder.Text = item.GTAWWelder;
txtGTAWInspector.Text = item.GTAWInspector;
txtSMAWWelder.Text = item.SMAWWelder;
txtVTInspector.Text = item.VTInspector;
}
}
else
{
this.drpPipeline.DataTextField = "ISO_IsoNo";
this.drpPipeline.DataValueField = "ISO_ID";
this.drpPipeline.DataSource = (from x in Funs.DB.HJGL_PW_IsoInfo where x.ProjectId == this.ProjectId orderby x.ISO_IsoNo select x).ToList();
this.drpPipeline.DataBind();
Funs.FineUIPleaseSelect(this.drpPipeline);
Funs.FineUIPleaseSelect(this.drpWeldingJoint);
}
}
}
#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, Const.JGZL_TeamWeldingInspectionMenuId, Const.BtnSave))
{
if (this.drpPipeline.SelectedValue==BLL.Const._Null||string.IsNullOrEmpty(this.drpPipeline.SelectedValue))
{
Alert.ShowInTop("请选择管道编号!", MessageBoxIcon.Warning);
return;
}
if (this.drpWeldingJoint.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpWeldingJoint.SelectedValue))
{
Alert.ShowInTop("请选择焊口编号!", MessageBoxIcon.Warning);
return;
}
Model.JGZL_TeamWeldingInspection newReport = new Model.JGZL_TeamWeldingInspection();
newReport.ProjectId = this.ProjectId;
newReport.UsingUnitTeam = this.txtUsingUnitTeam.Text.Trim();
newReport.InstallationArea = this.txtInstallationArea.Text.Trim();
newReport.CompileMan = this.CurrUser.UserId;
newReport.CompileDate = DateTime.Now;
Model.JGZL_TeamWeldingInspectionItem newItem = new Model.JGZL_TeamWeldingInspectionItem();
newItem.CheckDate = Funs.GetNewDateTime(this.txtCheckDate.Text);
newItem.Material = this.txtMaterial.Text;
newItem.PipelineNo = this.drpPipeline.SelectedValue;
newItem.WeldingJointNo = this.drpWeldingJoint.SelectedValue;
newItem.InstallationMethod = this.rblInstallationMethod.SelectedValue;
newItem.WeldingWire = this.txtWeldingWire.Text.Trim();
newItem.WeldingRod = this.txtWeldingRod.Text.Trim();
newItem.TeamGap = this.txtTeamGap.Text.Trim();
newItem.TeamPlumber=this.txtTeamPlumber.Text.Trim();
newItem.TeamWelder = this.txtTeamWelder.Text.Trim();
newItem.TeamInspector = this.txtTeamInspector.Text.Trim();
newItem.GTAWWelder =this.txtGTAWWelder.Text.Trim();
newItem.GTAWInspector=this.txtGTAWInspector.Text.Trim();
newItem.SMAWWelder=this.txtSMAWWelder.Text.Trim();
newItem.VTInspector = this.txtVTInspector.Text.Trim();
if (!string.IsNullOrEmpty(this.TeamWeldingInspectionItemId))
{
newItem.TeamWeldingInspectionItemId = this.TeamWeldingInspectionItemId;
var item = BLL.TeamWeldingInspectionItemService.GetTeamWeldingInspectionItemById(this.TeamWeldingInspectionItemId);
newReport.TeamWeldingInspectionId = item.TeamWeldingInspectionId;
BLL.TeamWeldingInspectionService.UpdateTeamWeldingInspection(newReport);
BLL.TeamWeldingInspectionItemService.UpdateTeamWeldingInspectionItem(newItem);
}
else
{
newReport.TeamWeldingInspectionId = SQLHelper.GetNewID(typeof(Model.JGZL_TeamWeldingInspection));
BLL.TeamWeldingInspectionService.AddTeamWeldingInspection(newReport);
newItem.TeamWeldingInspectionId = newReport.TeamWeldingInspectionId;
newItem.TeamWeldingInspectionItemId = SQLHelper.GetNewID(typeof(Model.JGZL_TeamWeldingInspectionItem));
BLL.TeamWeldingInspectionItemService.AddTeamWeldingInspectionItem(newItem);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
protected void drpPipeline_SelectedIndexChanged(object sender, EventArgs e)
{
this.drpWeldingJoint.Items.Clear();
if (this.drpPipeline.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpPipeline.SelectedValue))
{
this.drpWeldingJoint.DataTextField = "JOT_JointNo";
this.drpWeldingJoint.DataValueField = "JOT_ID";
this.drpWeldingJoint.DataSource = (from x in Funs.DB.HJGL_PW_JointInfo where x.ISO_ID == this.drpPipeline.SelectedValue select x).ToList().OrderBy(x => x.Sort1).OrderBy(x => x.Sort2).OrderBy(x => x.Sort3).OrderBy(x => x.Sort4).OrderBy(x => x.Sort5);
this.drpWeldingJoint.DataBind();
}
Funs.FineUIPleaseSelect(this.drpWeldingJoint);
this.drpWeldingJoint.SelectedIndex = 0;
}
}
}