544 lines
21 KiB
C#
544 lines
21 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using BLL;
|
|
|
|
namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
|
{
|
|
public partial class PipelineManageEdit : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 管线主键
|
|
/// </summary>
|
|
public string PipelineId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["PipelineId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["PipelineId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 项目主键
|
|
/// </summary>
|
|
public string ProjectId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ProjectId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ProjectId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 单位主键
|
|
/// </summary>
|
|
public string UnitId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["UnitId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["UnitId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 装置主键
|
|
/// </summary>
|
|
public string InstallationId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["InstallationId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["InstallationId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 区域主键
|
|
/// </summary>
|
|
public string WorkAreaId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["WorkAreaId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["WorkAreaId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载页面
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
Grid1.Hidden = true;
|
|
this.PipelineId = Request.Params["PipelineId"];
|
|
|
|
Base_MaterialService.InitMaterialDropDownList(this.drpMainMaterial, true, Resources.Lan.PleaseSelect);
|
|
Base_MediumService.InitMediumDropDownList(this.drpMedium, true,Resources.Lan.PleaseSelect);
|
|
Base_PipingClassService.InitPipingClassDropDownList(this.drpPipingClass, true,Resources.Lan.PleaseSelect);
|
|
Base_DetectionRateService.InitDetectionRateDropDownList(drpDetectionRate, Resources.Lan.PleaseSelect, true);
|
|
Base_PIPClassService.InitPIPClassDropDownList(drpPipClass, true, Resources.Lan.PleaseSelect);
|
|
|
|
this.drpIfPickling.DataValueField = "Value";
|
|
this.drpIfPickling.DataTextField = "Text";
|
|
this.drpIfPickling.DataSource = DropListService.IsTrueOrFalseDrpList();
|
|
this.drpIfPickling.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpIfPickling,Resources.Lan.PleaseSelect);
|
|
if (!string.IsNullOrEmpty(this.PipelineId))
|
|
{
|
|
Model.View_Pipeline_Pipeline pipeline = BLL.Pipeline_PipelineService.GetViewPipelineByPipelineId(this.PipelineId);
|
|
this.ProjectId = pipeline.ProjectId;
|
|
this.UnitId = pipeline.UnitId;
|
|
this.InstallationId = pipeline.InstallationId;
|
|
this.WorkAreaId = pipeline.WorkAreaId;
|
|
this.txtPipelineCode.Text = pipeline.PipelineCode;
|
|
this.txtUnitName.Text = pipeline.UnitName;
|
|
this.txtWorkAreaCode.Text = pipeline.WorkAreaCode;
|
|
if (!string.IsNullOrEmpty(pipeline.MainMaterialId))
|
|
{
|
|
this.drpMainMaterial.SelectedValue = pipeline.MainMaterialId;
|
|
}
|
|
if (!string.IsNullOrEmpty(pipeline.MediumId))
|
|
{
|
|
this.drpMedium.SelectedValue = pipeline.MediumId;
|
|
}
|
|
if (!string.IsNullOrEmpty(pipeline.PipingClassId))
|
|
{
|
|
this.drpPipingClass.SelectedValue = pipeline.PipingClassId;
|
|
}
|
|
if (!string.IsNullOrEmpty(pipeline.PIPClassId))
|
|
{
|
|
this.drpPipClass.SelectedValue = pipeline.PIPClassId;
|
|
}
|
|
this.txtSpecification.Text = pipeline.Specification;
|
|
this.txtSingleNumber.Text = pipeline.SingleNumber;
|
|
this.txtWorkPackageCode.Text = pipeline.WorkPackageCode;
|
|
this.txtSystemNumber.Text = pipeline.SystemNumber;
|
|
this.txtSubSystemNumber.Text = pipeline.SubSystemNumber;
|
|
if (pipeline.PipeSegment != null)
|
|
{
|
|
this.txtPipeSegment.Text = pipeline.PipeSegment.ToString();
|
|
}
|
|
//this.txtSheet.Text = pipeline.Sheet;
|
|
this.txtDrawingsNum.Text = pipeline.DrawingsNum;
|
|
this.txtDesignTemperature.Text = pipeline.DesignTemperature;
|
|
this.txtTestPressure.Text = pipeline.TestPressure;
|
|
this.txtDesignPressure.Text = pipeline.DesignPressure;
|
|
if (pipeline.IfPickling == true)
|
|
{
|
|
this.drpIfPickling.SelectedValue = BLL.Const._True;
|
|
}
|
|
else if (pipeline.IfPickling == false)
|
|
{
|
|
this.drpIfPickling.SelectedValue = BLL.Const._False;
|
|
}
|
|
if (pipeline.DetectionRateId != null)
|
|
{
|
|
this.drpDetectionRate.SelectedValue = pipeline.DetectionRateId;
|
|
}
|
|
if (pipeline.QueClass != null)
|
|
{
|
|
this.drpQueClass.SelectedValue = pipeline.QueClass;
|
|
}
|
|
this.txtExecStandard.Text = pipeline.ExecStandard;
|
|
this.txtRemark.Text = pipeline.Remark;
|
|
BindGrid();
|
|
}
|
|
else
|
|
{
|
|
this.WorkAreaId = Request.Params["workAreaId"];
|
|
Model.Project_WorkArea workArea = BLL.Project_WorkAreaService.GetProject_WorkAreaByWorkAreaId(this.WorkAreaId);
|
|
if (workArea != null)
|
|
{
|
|
this.ProjectId = workArea.ProjectId;
|
|
this.UnitId = workArea.UnitId;
|
|
this.InstallationId = workArea.InstallationId;
|
|
this.txtWorkAreaCode.Text = workArea.WorkAreaCode;
|
|
this.txtUnitName.Text = BLL.Base_UnitService.GetUnitNameByUnitId(this.UnitId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 管线等级下拉框变化加载对应的条件设置
|
|
/// <summary>
|
|
/// 管线等级下拉框变化加载对应的条件设置
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void drpPipingClass_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (this.drpPipingClass.SelectedValue != BLL.Const._Null)
|
|
{
|
|
if (string.IsNullOrEmpty(this.PipelineId))
|
|
{
|
|
SaveData(false);
|
|
}
|
|
BLL.Pipeline_PipelineDetectionTypeService.DeletePipelineDetectionTypeByPipelineId(this.PipelineId);
|
|
var pipingClassDetails = BLL.Base_PipingClassDetailService.GetPipingClassDetailByPipingClassId(this.drpPipingClass.SelectedValue);
|
|
foreach (var pipingClassDetail in pipingClassDetails)
|
|
{
|
|
Model.Pipeline_PipelineDetectionType pipelineDetectionType = new Model.Pipeline_PipelineDetectionType();
|
|
pipelineDetectionType.PipelineDetectionTypeId = SQLHelper.GetNewID(typeof(Model.Pipeline_PipelineDetectionType));
|
|
pipelineDetectionType.PipelineId = this.PipelineId;
|
|
pipelineDetectionType.WeldTypeId = pipingClassDetail.WeldTypeId;
|
|
pipelineDetectionType.DetectionTypeId = pipingClassDetail.DetectionTypeId;
|
|
pipelineDetectionType.DetectionRateId = pipingClassDetail.DetectionRateId;
|
|
pipelineDetectionType.MinThickness = pipingClassDetail.ThicknessMin;
|
|
pipelineDetectionType.MaxThickness = pipingClassDetail.ThicknessMax;
|
|
pipelineDetectionType.MinDia = pipingClassDetail.SizeMin;
|
|
pipelineDetectionType.MaxDia = pipingClassDetail.SizeMax;
|
|
BLL.Pipeline_PipelineDetectionTypeService.AddPipelineDetectionType(pipelineDetectionType);
|
|
}
|
|
BindGrid();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 数据绑定
|
|
/// <summary>
|
|
/// 数据绑定
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
DataTable tb = this.LINQToDataTable(BLL.Pipeline_PipelineDetectionTypeService.GetPipelineDetectionTypeList(this.PipelineId));
|
|
// 2.获取当前分页数据
|
|
//var table = this.GetPagedDataTable(GridNewDynamic, tb1);
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
#endregion
|
|
|
|
#region 排序
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
//List<Model.HJGL_SpRpWeldReportItem> GetWeldReportItem = this.CollectGridJointInfo();
|
|
//this.BindGrid(GetWeldReportItem);
|
|
}
|
|
#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.HJGL_PipelineManageMenuId, Const.BtnSave))
|
|
{
|
|
if (BLL.Pipeline_PipelineService.IsExistPipelineCode(this.txtPipelineCode.Text.Trim(), this.WorkAreaId, this.PipelineId))
|
|
{
|
|
Alert.ShowInTop("该管线号已存在!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
SaveData(true);
|
|
// 关闭本窗体,然后回发父窗体
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
private void SaveData(bool b)
|
|
{
|
|
Model.Pipeline_Pipeline pipeline = new Model.Pipeline_Pipeline();
|
|
pipeline.ProjectId = this.ProjectId;
|
|
pipeline.InstallationId = this.InstallationId;
|
|
pipeline.UnitId = this.UnitId;
|
|
pipeline.WorkAreaId = this.WorkAreaId;
|
|
pipeline.PipelineCode = this.txtPipelineCode.Text.Trim();
|
|
if (this.drpMainMaterial.SelectedValue != BLL.Const._Null)
|
|
{
|
|
pipeline.MainMaterialId = this.drpMainMaterial.SelectedValue;
|
|
}
|
|
|
|
if (this.drpMedium.SelectedValue != BLL.Const._Null)
|
|
{
|
|
pipeline.MediumId = this.drpMedium.SelectedValue;
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择介质!");
|
|
return;
|
|
}
|
|
if (this.drpPipingClass.SelectedValue != BLL.Const._Null)
|
|
{
|
|
pipeline.PipingClassId = this.drpPipingClass.SelectedValue;
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择管线等级!");
|
|
return;
|
|
}
|
|
|
|
if (this.drpDetectionRate.SelectedValue != BLL.Const._Null)
|
|
{
|
|
pipeline.DetectionRateId = this.drpDetectionRate.SelectedValue;
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请设置探伤比例!");
|
|
return;
|
|
}
|
|
pipeline.Specification = this.txtSpecification.Text.Trim();
|
|
pipeline.SingleNumber = this.txtSingleNumber.Text.Trim();
|
|
pipeline.WorkPackageCode = this.txtWorkPackageCode.Text.Trim();
|
|
pipeline.SystemNumber = this.txtSystemNumber.Text.Trim();
|
|
pipeline.SubSystemNumber = this.txtSubSystemNumber.Text.Trim();
|
|
pipeline.PipeSegment = Funs.GetNewInt(this.txtPipeSegment.Text.Trim());
|
|
//pipeline.Sheet = this.txtSheet.Text.Trim();
|
|
pipeline.DrawingsNum = this.txtDrawingsNum.Text.Trim();
|
|
pipeline.DesignTemperature = this.txtDesignTemperature.Text.Trim();
|
|
pipeline.TestPressure = this.txtTestPressure.Text.Trim();
|
|
pipeline.DesignPressure = this.txtDesignPressure.Text.Trim();
|
|
if (this.drpIfPickling.SelectedValue != BLL.Const._Null)
|
|
{
|
|
pipeline.IfPickling = Convert.ToBoolean(this.drpIfPickling.SelectedValue);
|
|
}
|
|
if (this.drpDetectionRate.SelectedValue != BLL.Const._Null)
|
|
{
|
|
pipeline.DetectionRateId = this.drpDetectionRate.SelectedValue;
|
|
}
|
|
|
|
if (this.drpPipClass.SelectedValue != BLL.Const._Null)
|
|
{
|
|
pipeline.PIPClassId = this.drpPipClass.SelectedValue;
|
|
}
|
|
|
|
if (drpQueClass.SelectedValue != "0")
|
|
{
|
|
pipeline.QueClass = drpQueClass.SelectedValue;
|
|
}
|
|
pipeline.ExecStandard = txtExecStandard.Text.Trim();
|
|
pipeline.Remark = this.txtRemark.Text.Trim();
|
|
if (!string.IsNullOrEmpty(this.PipelineId))
|
|
{
|
|
pipeline.PipelineId = this.PipelineId;
|
|
BLL.Pipeline_PipelineService.UpdatePipeline(pipeline);
|
|
if (b)
|
|
{
|
|
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PipelineManageMenuId, Const.BtnModify, this.PipelineId);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.PipelineId = SQLHelper.GetNewID(typeof(Model.Pipeline_Pipeline));
|
|
pipeline.PipelineId = this.PipelineId;
|
|
BLL.Pipeline_PipelineService.AddPipeline(pipeline);
|
|
if (b)
|
|
{
|
|
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PipelineManageMenuId, Const.BtnAdd, this.PipelineId);
|
|
}
|
|
}
|
|
|
|
var pointList = from x in Funs.DB.Batch_PointBatch where x.PipelineId == pipeline.PipelineId select x;
|
|
if (pointList.Count() > 0)
|
|
{
|
|
foreach (var p in pointList)
|
|
{
|
|
string[] pointStr = p.PointBatchCode.Split('-');
|
|
string code = pointStr[pointStr.Count() - 2];
|
|
if (p.DetectionRateId != pipeline.DetectionRateId)
|
|
{
|
|
p.DetectionRateId = pipeline.DetectionRateId;
|
|
p.PointBatchCode = p.PointBatchCode.Replace(code, drpDetectionRate.SelectedText);
|
|
|
|
var pointItem = from x in Funs.DB.Batch_PointBatchItem where x.PointBatchId == p.PointBatchId select x;
|
|
var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(pipeline.DetectionRateId);
|
|
foreach (var item in pointItem)
|
|
{
|
|
if (rate.DetectionRateValue == 5 || rate.DetectionRateValue == 10)
|
|
{
|
|
item.AcceptLevel = "Ⅲ";
|
|
}
|
|
else
|
|
{
|
|
item.AcceptLevel = "Ⅱ";
|
|
}
|
|
}
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
#region 增加按钮事件
|
|
/// <summary>
|
|
/// 增加按钮事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnNew_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PipelineManageMenuId, Const.BtnAdd))
|
|
{
|
|
if (string.IsNullOrEmpty(this.PipelineId))
|
|
{
|
|
SaveData(false);
|
|
}
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PipelineDetectionTypeEdit.aspx?PipelineId={0}", this.PipelineId, "新增 - ")));
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 改变索引事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页下拉选择事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
BindGrid();
|
|
}
|
|
|
|
#region Grid 关闭弹出窗口事件
|
|
/// <summary>
|
|
/// 关闭弹出窗口
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 右键删除事件
|
|
/// <summary>
|
|
/// 右键删除事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PipelineManageMenuId, Const.BtnDelete))
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length > 0)
|
|
{
|
|
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|
{
|
|
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
|
BLL.Pipeline_PipelineDetectionTypeService.DeletePipelineDetectionTypeById(rowID);
|
|
}
|
|
|
|
BindGrid();
|
|
ShowNotify(Resources.Lan.DeletedSuccessfully, MessageBoxIcon.Success);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 编辑
|
|
/// <summary>
|
|
/// 双击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
this.EditData();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 右键编辑事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
{
|
|
this.EditData();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编辑数据方法
|
|
/// </summary>
|
|
private void EditData()
|
|
{
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop(Resources.Lan.SelectLeastOneRecord, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
////双击事件 编辑权限有:编辑页面,无:提示无权限
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PipelineManageMenuId, Const.BtnModify))
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PipelineDetectionTypeEdit.aspx?PipelineDetectionTypeId={0}", Grid1.SelectedRowID, "编辑 - ")));
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |