134 lines
5.3 KiB
C#
134 lines
5.3 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.HJGL.PreWeld
|
|
{
|
|
public partial class FitupCheckEdit : PageBase
|
|
{
|
|
public string WeldJointId
|
|
{
|
|
get { return (string)ViewState["WeldJointId"]; }
|
|
set { ViewState["WeldJointId"] = value; }
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
WeldJointId = Request.Params["WeldJointId"];
|
|
BindWeldJoint();
|
|
BindGrooveType();
|
|
if (!string.IsNullOrEmpty(WeldJointId))
|
|
{
|
|
BindData();
|
|
}
|
|
else
|
|
{
|
|
dpCheckTime.SelectedDate = DateTime.Now;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void BindWeldJoint()
|
|
{
|
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
|
{
|
|
var data = (from x in db.HJGL_WeldJoint
|
|
where x.ProjectId == CurrUser.LoginProjectId
|
|
orderby x.PipelineCode, x.WeldJointCode
|
|
select new
|
|
{
|
|
x.WeldJointId,
|
|
WeldJointName = x.PipelineCode + " / " + x.WeldJointCode
|
|
}).ToList();
|
|
drpWeldJoint.DataTextField = "WeldJointName";
|
|
drpWeldJoint.DataValueField = "WeldJointId";
|
|
drpWeldJoint.DataSource = data;
|
|
drpWeldJoint.DataBind();
|
|
}
|
|
}
|
|
|
|
private void BindGrooveType()
|
|
{
|
|
drpGrooveType.DataTextField = "BaseInfoName";
|
|
drpGrooveType.DataValueField = "BaseInfoId";
|
|
drpGrooveType.DataSource = APIBaseInfoService.getGrooveType();
|
|
drpGrooveType.DataBind();
|
|
}
|
|
|
|
private void BindData()
|
|
{
|
|
var model = PreWeldInspectionService.GetFitupCheckByWeldJointId(WeldJointId);
|
|
var weldJoint = APIPreWeldInspectionService.GetPreWeldJointByWeldJointId(WeldJointId);
|
|
if (weldJoint != null)
|
|
{
|
|
drpWeldJoint.SelectedValue = weldJoint.WeldJointId;
|
|
drpWeldJoint.Enabled = false;
|
|
drpGrooveType.SelectedValue = weldJoint.GrooveTypeId;
|
|
txtGrooveProcessType.Text = weldJoint.GrooveProcessType;
|
|
if (weldJoint.GrooveAngle.HasValue)
|
|
{
|
|
numGrooveAngle.Text = weldJoint.GrooveAngle.Value.ToString();
|
|
}
|
|
if (weldJoint.FitupGap.HasValue)
|
|
{
|
|
numFitupGap.Text = weldJoint.FitupGap.Value.ToString();
|
|
}
|
|
if (weldJoint.Misalignment.HasValue)
|
|
{
|
|
numMisalignment.Text = weldJoint.Misalignment.Value.ToString();
|
|
}
|
|
}
|
|
if (model != null)
|
|
{
|
|
drpGrooveType.SelectedValue = model.GrooveTypeId;
|
|
txtGrooveProcessType.Text = model.GrooveProcessType;
|
|
if (model.GrooveAngle.HasValue)
|
|
{
|
|
numGrooveAngle.Text = model.GrooveAngle.Value.ToString();
|
|
}
|
|
if (model.FitupGap.HasValue)
|
|
{
|
|
numFitupGap.Text = model.FitupGap.Value.ToString();
|
|
}
|
|
if (model.Misalignment.HasValue)
|
|
{
|
|
numMisalignment.Text = model.Misalignment.Value.ToString();
|
|
}
|
|
dpCheckTime.SelectedDate = model.CheckTime;
|
|
txtRemark.Text = model.Remark;
|
|
}
|
|
}
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (!CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.PersonId, Const.HJGL_PreWeldFitupCheckMenuId, Const.BtnSave))
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
var item = new Model.PreWeldFitupCheckItem
|
|
{
|
|
ProjectId = CurrUser.LoginProjectId,
|
|
WeldJointId = drpWeldJoint.SelectedValue,
|
|
GrooveTypeId = drpGrooveType.SelectedValue,
|
|
GrooveProcessType = txtGrooveProcessType.Text.Trim(),
|
|
GrooveAngle = string.IsNullOrWhiteSpace(numGrooveAngle.Text) ? (decimal?)null : Convert.ToDecimal(numGrooveAngle.Text),
|
|
FitupGap = string.IsNullOrWhiteSpace(numFitupGap.Text) ? (decimal?)null : Convert.ToDecimal(numFitupGap.Text),
|
|
Misalignment = string.IsNullOrWhiteSpace(numMisalignment.Text) ? (decimal?)null : Convert.ToDecimal(numMisalignment.Text),
|
|
CheckPerson = CurrUser.PersonId,
|
|
CheckTime = dpCheckTime.SelectedDate ?? DateTime.Now,
|
|
CreateUser = CurrUser.PersonId,
|
|
Remark = txtRemark.Text.Trim()
|
|
};
|
|
|
|
APIPreWeldInspectionService.SaveFitupCheck(item);
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
}
|
|
}
|