ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/HJGL/WeldingManage/PipelineManageEdit.aspx.cs

1044 lines
44 KiB
C#

namespace FineUIPro.Web.HJGL.WeldingManage
{
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using BLL;
public partial class PipelineManageEdit : PageBase
{
#region
/// <summary>
/// 管线主键
/// </summary>
private string ISO_ID
{
get
{
return (string)ViewState["ISO_ID"];
}
set
{
ViewState["ISO_ID"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
this.ISO_ID = string.Empty;
if (!string.IsNullOrEmpty(Request.Params["ISO_ID"]))
{
this.ISO_ID = Request.Params["ISO_ID"];
}
if (Request.Params["type"] == "view")
{
this.btnSave.Hidden = true;
}
var isoInfo = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(this.ISO_ID);
////初始化页面信息
this.PersonLoad(isoInfo);
this.BindGrid();
}
}
#endregion
#region
/// <summary>
/// 初始化页面信息
/// </summary>
protected void PersonLoad(Model.HJGL_PW_IsoInfo isoInfo)
{
///介质
this.drpSER.DataTextField = "SER_Name";
this.drpSER.DataValueField = "SER_ID";
this.drpSER.DataSource = BLL.HJGL_MediumService.GetBSServiceList();
this.drpSER.DataBind();
Funs.FineUIPleaseSelect(this.drpSER);
///材质
this.drpSTEName.DataTextField = "STE_Code";
this.drpSTEName.DataValueField = "STE_ID";
this.drpSTEName.DataSource = BLL.HJGL_MaterialService.GetSteelList();
this.drpSTEName.DataBind();
Funs.FineUIPleaseSelect(this.drpSTEName);
// 执行标准
this.drpExecStandard.DataTextField = "ExecStandardName";
this.drpExecStandard.DataValueField = "ExecStandardId";
this.drpExecStandard.DataSource = BLL.HJGL_ExecStandardService.GetExecStandardNameList();
this.drpExecStandard.DataBind();
Funs.FineUIPleaseSelect(this.drpExecStandard);
///管道等级
this.drpIDName.DataTextField = "ISC_IsoName";
this.drpIDName.DataValueField = "ISC_ID";
this.drpIDName.DataSource = BLL.HJGL_PipingClassService.GetIsoClassNameList();
this.drpIDName.DataBind();
Funs.FineUIPleaseSelect(this.drpIDName);
this.drpMaterialStandardId.DataTextField = "MaterialStandardCode";
this.drpMaterialStandardId.DataValueField = "MaterialStandardId";
this.drpMaterialStandardId.DataSource = BLL.HJGL_MaterialStandardService.GetMaterialStandardList();
this.drpMaterialStandardId.DataBind();
Funs.FineUIPleaseSelect(this.drpMaterialStandardId);
this.drpPipeLineClass.DataTextField = "Text";
this.drpPipeLineClass.DataValueField = "Value";
this.drpPipeLineClass.DataSource = BLL.DropListService.HJGL_PipeLineClassItem();
this.drpPipeLineClass.DataBind();
Funs.FineUIPleaseSelect(this.drpPipeLineClass);
this.drpBUS_ID.DataTextField = "UnitName";
this.drpBUS_ID.DataValueField = "UnitId";
this.drpBUS_ID.DataSource = BLL.Base_UnitService.GetUnitCodeByProjectIdList(this.CurrUser.LoginProjectId);
this.drpBUS_ID.DataBind();
Funs.FineUIPleaseSelect(this.drpBUS_ID);
//对接焊缝检测比例
this.drpJoty_B_Rate.DataTextField = "NDTR_Name";
this.drpJoty_B_Rate.DataValueField = "NDTR_ID";
this.drpJoty_B_Rate.DataSource = BLL.HJGL_DetectionService.GetNDTRateNameList();
this.drpJoty_B_Rate.DataBind();
Funs.FineUIPleaseSelect(this.drpJoty_B_Rate);
//角焊缝检测比例
this.drpJoty_C_Rate.DataTextField = "NDTR_Name";
this.drpJoty_C_Rate.DataValueField = "NDTR_ID";
this.drpJoty_C_Rate.DataSource = BLL.HJGL_DetectionService.GetNDTRateNameList();
this.drpJoty_C_Rate.DataBind();
Funs.FineUIPleaseSelect(this.drpJoty_C_Rate);
//支管链接接头检测比例
this.drpJoty_D_Rate.DataTextField = "NDTR_Name";
this.drpJoty_D_Rate.DataValueField = "NDTR_ID";
this.drpJoty_D_Rate.DataSource = BLL.HJGL_DetectionService.GetNDTRateNameList();
this.drpJoty_D_Rate.DataBind();
Funs.FineUIPleaseSelect(this.drpJoty_D_Rate);
this.drpJoty_Level.DataTextField = "Text";
this.drpJoty_Level.DataValueField = "Value";
this.drpJoty_Level.DataSource = BLL.DropListService.HJGL_Joty_LevelItem();
this.drpJoty_Level.DataBind();
Funs.FineUIPleaseSelect(this.drpJoty_Level);
this.drpJoty_C_Level.DataTextField = "Text";
this.drpJoty_C_Level.DataValueField = "Value";
this.drpJoty_C_Level.DataSource = BLL.DropListService.HJGL_Joty_LevelItem();
this.drpJoty_C_Level.DataBind();
Funs.FineUIPleaseSelect(this.drpJoty_C_Level);
this.drpJoty_D_Level.DataTextField = "Text";
this.drpJoty_D_Level.DataValueField = "Value";
this.drpJoty_D_Level.DataSource = BLL.DropListService.HJGL_Joty_LevelItem();
this.drpJoty_D_Level.DataBind();
Funs.FineUIPleaseSelect(this.drpJoty_D_Level);
if (isoInfo != null)
{
var batch = from x in Funs.DB.HJGL_BO_BatchDetail where x.ISO_ID == isoInfo.ISO_ID select x;
if (batch.Count() > 0) // //如有管线进入批则不能修改下列组批数据
{
drpIDName.Enabled = false;
drpSTEName.Enabled = false;
drpExecStandard.Enabled = false;
drpJoty_B_Rate.Enabled = false;
drpJoty_C_Rate.Enabled = false;
drpJoty_D_Rate.Enabled = false;
}
if (CurrUser.Account != Const.Gly)
{
var que = from x in Funs.DB.HJGL_BO_QualityRating where x.ISO_ID == isoInfo.ISO_ID select x;
if (que.Count() > 0)
{
txtISO_IsoNo.Enabled = false;
}
}
this.txtISO_IsoNo.Text = isoInfo.ISO_IsoNo;
if (!string.IsNullOrEmpty(isoInfo.BSU_ID))
{
this.drpBUS_ID.SelectedValue = isoInfo.BSU_ID;
}
if (!string.IsNullOrEmpty(isoInfo.SER_ID))
{
this.drpSER.SelectedValue = isoInfo.SER_ID;
var ser = BLL.HJGL_MediumService.GetServiceBySERID(this.drpSER.SelectedValue);
if (ser != null)
{
this.txtServiceAbbreviate.Text = ser.SER_Abbreviate;
}
}
if (!string.IsNullOrEmpty(isoInfo.STE_ID))
{
this.drpSTEName.SelectedValue = isoInfo.STE_ID;
}
this.txtISO_Paint.Text = isoInfo.ISO_Paint;
this.txtISO_Insulator.Text = isoInfo.ISO_Insulator;
if (!string.IsNullOrEmpty(isoInfo.ISO_Executive))
{
this.drpExecStandard.SelectedValue = isoInfo.ISO_Executive;
}
this.txtISO_DesignPress.Text = isoInfo.ISO_DesignPress.ToString();
this.txtISO_DesignTemperature.Text = isoInfo.ISO_DesignTemperature.ToString();
this.txtISO_TestPress.Text = isoInfo.ISO_TestPress.ToString();
if (!string.IsNullOrEmpty(isoInfo.ISC_ID))
{
this.drpIDName.SelectedValue = isoInfo.ISC_ID;
}
this.txtISO_Remark.Text = isoInfo.ISO_Remark;
if (!string.IsNullOrEmpty(isoInfo.MaterialStandardId))
{
this.drpMaterialStandardId.SelectedValue = isoInfo.MaterialStandardId;
}
if (!string.IsNullOrEmpty(isoInfo.PressureTestPackageNo))
{
this.txtPressureTestPackageNo.Text = isoInfo.PressureTestPackageNo;
}
else
{
this.txtPressureTestPackageNo.Text = "/";
}
this.txtOperatingPressure.Text = isoInfo.OperatingPressure;
this.txtOperatingTemperature.Text = isoInfo.OperatingTemperature;
if (!string.IsNullOrEmpty(isoInfo.PipeLineClass))
{
this.drpPipeLineClass.SelectedValue = isoInfo.PipeLineClass;
}
if (isoInfo.PipeLineLength.HasValue)
{
this.txtPipeLineLength.Text = Convert.ToString(isoInfo.PipeLineLength);
}
this.txtLeakageTest.Text = isoInfo.LeakageTest;
this.txtTestCategoryNum.Text = isoInfo.TestCategoryNum;
if (!string.IsNullOrEmpty(isoInfo.Joty_B_Rate))
{
drpJoty_B_Rate.SelectedValue = isoInfo.Joty_B_Rate;
}
if (!string.IsNullOrEmpty(isoInfo.Joty_C_Rate))
{
drpJoty_C_Rate.SelectedValue = isoInfo.Joty_C_Rate;
}
if (!string.IsNullOrEmpty(isoInfo.Joty_D_Rate))
{
drpJoty_D_Rate.SelectedValue = isoInfo.Joty_D_Rate;
}
if (!string.IsNullOrEmpty(isoInfo.Joty_B_Level))
{
drpJoty_Level.SelectedValue = isoInfo.Joty_B_Level;
}
if (!string.IsNullOrEmpty(isoInfo.Joty_C_Level))
{
drpJoty_C_Level.SelectedValue = isoInfo.Joty_C_Level;
}
if (!string.IsNullOrEmpty(isoInfo.Joty_D_Level))
{
drpJoty_D_Level.SelectedValue = isoInfo.Joty_D_Level;
}
if (!string.IsNullOrEmpty(isoInfo.IsHot))
{
this.drpIsHot.SelectedValue = isoInfo.IsHot;
if (isoInfo.IsHot == "1")
{
this.drpIsHotType.Hidden = false;
this.lbl.Hidden = true;
if (!string.IsNullOrEmpty(isoInfo.IsHotType))
{
string[] proessTypes = isoInfo.IsHotType.Split('|');
this.drpIsHotType.Values = proessTypes;
}
}
}
if (isoInfo.ISO_Dia != null)
{
this.txtDia.Text = isoInfo.ISO_Dia.ToString();
}
if (isoInfo.ISO_Sch != null)
{
this.txtSch.Text = isoInfo.ISO_Sch.ToString();
}
}
else
{
//选择管道等级、执行标准时,自动添加对接焊缝检测比例、合格等级、支管连接接头检测比例、合格等级、角焊缝检测比例、合格等级
var weldControl = BLL.HJGL_WeldControlService.GEtWeldControlByISCIDAndExecStandardId(this.drpIDName.SelectedValue, this.drpExecStandard.SelectedValue);
if (weldControl != null)
{
if (!string.IsNullOrEmpty(weldControl.Joty_Rate))
{
var rate = BLL.HJGL_DetectionService.GetNDTRateByNDTRID(weldControl.Joty_Rate);
if (rate != null)
{
this.txtTestCategoryNum.Text = rate.NDTR_Code;
}
drpJoty_B_Rate.SelectedValue = weldControl.Joty_Rate;
}
if (!string.IsNullOrEmpty(weldControl.Joty_Level))
{
this.drpJoty_Level.SelectedValue = weldControl.Joty_Level;
}
if (!string.IsNullOrEmpty(weldControl.Joty_C_Rate))
{
drpJoty_C_Rate.SelectedValue = weldControl.Joty_C_Rate;
}
if (!string.IsNullOrEmpty(weldControl.Joty_C_Level))
{
this.drpJoty_C_Level.SelectedValue = weldControl.Joty_C_Level;
}
if (!string.IsNullOrEmpty(weldControl.Joty_D_Rate))
{
drpJoty_D_Rate.SelectedValue = weldControl.Joty_D_Rate;
}
if (!string.IsNullOrEmpty(weldControl.Joty_D_Level))
{
this.drpJoty_D_Level.SelectedValue = weldControl.Joty_D_Level;
}
}
txtPressureTestPackageNo.Text = "/";
}
}
#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.HJGL_PW_IsoInfoService.IsExistIsoInfoCode(this.txtISO_IsoNo.Text.Trim(), this.CurrUser.LoginProjectId, this.ISO_ID))
{
Alert.ShowInTop("该单线图号已存在!", MessageBoxIcon.Warning);
return;
}
Model.HJGL_PW_IsoInfo iso = new Model.HJGL_PW_IsoInfo();
iso.ProjectId = this.CurrUser.LoginProjectId;
if (this.drpBUS_ID.SelectedValue != BLL.Const._Null)
{
iso.BSU_ID = this.drpBUS_ID.SelectedValue;
}
else
{
Alert.ShowInTop("请选择单位!", MessageBoxIcon.Warning);
return;
}
if (this.drpExecStandard.SelectedValue != BLL.Const._Null)
{
iso.ISO_Executive = this.drpExecStandard.SelectedValue;
}
else
{
Alert.ShowInTop("请选择执行标准!", MessageBoxIcon.Warning);
return;
}
if (this.drpIDName.SelectedValue != BLL.Const._Null)
{
iso.ISC_ID = this.drpIDName.SelectedValue;
}
else
{
Alert.ShowInTop("请选择管道等级!", MessageBoxIcon.Warning);
return;
}
if (this.drpSTEName.SelectedValue != BLL.Const._Null)
{
iso.STE_ID = this.drpSTEName.SelectedValue;
}
else
{
Alert.ShowInTop("请选择材质!", MessageBoxIcon.Warning);
return;
}
if (this.drpSER.SelectedValue != BLL.Const._Null)
{
iso.SER_ID = this.drpSER.SelectedValue;
}
else
{
Alert.ShowInTop("请选择介质!", MessageBoxIcon.Warning);
return;
}
iso.ISO_IsoNo = this.txtISO_IsoNo.Text.Trim();
if (!string.IsNullOrEmpty(this.txtISO_Paint.Text.Trim()))
{
iso.ISO_Paint = this.txtISO_Paint.Text.Trim();
}
else
{
Alert.ShowInTop("请输入涂漆类别!", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtISO_Insulator.Text.Trim()))
{
iso.ISO_Insulator = this.txtISO_Insulator.Text.Trim();
}
else
{
Alert.ShowInTop("请输入绝热类别!", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtISO_DesignPress.Text))
{
iso.ISO_DesignPress = Funs.GetNewDecimal(this.txtISO_DesignPress.Text);
}
else
{
Alert.ShowInTop("请输入设计压力!", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtISO_DesignTemperature.Text))
{
iso.ISO_DesignTemperature = Funs.GetNewDecimal(this.txtISO_DesignTemperature.Text);
}
else
{
Alert.ShowInTop("请输入设计温度!", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtISO_TestPress.Text))
{
iso.ISO_TestPress = Funs.GetNewDecimal(this.txtISO_TestPress.Text);
}
else
{
Alert.ShowInTop("请输入耐压试验!", MessageBoxIcon.Warning);
return;
}
iso.ISO_Remark = this.txtISO_Remark.Text.Trim();
if (this.drpMaterialStandardId.SelectedValue != BLL.Const._Null)
{
iso.MaterialStandardId = this.drpMaterialStandardId.SelectedValue;
}
else
{
Alert.ShowInTop("请选择材质标准!", MessageBoxIcon.Warning);
return;
}
iso.PressureTestPackageNo = this.txtPressureTestPackageNo.Text.Trim();
if (!string.IsNullOrEmpty(this.txtOperatingPressure.Text.Trim()))
{
iso.OperatingPressure = this.txtOperatingPressure.Text.Trim();
}
else
{
Alert.ShowInTop("请输入操作压力!", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtOperatingTemperature.Text.Trim()))
{
iso.OperatingTemperature = this.txtOperatingTemperature.Text.Trim();
}
else
{
Alert.ShowInTop("请输入操作温度!", MessageBoxIcon.Warning);
return;
}
if (this.drpPipeLineClass.SelectedValue != BLL.Const._Null)
{
iso.PipeLineClass = this.drpPipeLineClass.SelectedValue;
}
else
{
Alert.ShowInTop("请选择管道类别!", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtPipeLineLength.Text.Trim()))
{
iso.PipeLineLength = Funs.GetNewDecimal(this.txtPipeLineLength.Text.Trim());
}
else
{
Alert.ShowInTop("请输入管线长度!", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtLeakageTest.Text.Trim()))
{
iso.LeakageTest = this.txtLeakageTest.Text.Trim();
}
else
{
Alert.ShowInTop("请输入泄露性试验!", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtTestCategoryNum.Text.Trim()))
{
iso.TestCategoryNum = this.txtTestCategoryNum.Text.Trim();
}
else
{
Alert.ShowInTop("请输入检测类别序号!", MessageBoxIcon.Warning);
return;
}
if (this.drpIsHot.SelectedValue != BLL.Const._Null)
{
iso.IsHot = this.drpIsHot.SelectedValue;
if (this.drpIsHot.SelectedValue == "1")
{
if (this.drpIsHotType.Values.Length > 0)
{
iso.IsHotType = String.Join("|", drpIsHotType.Values);
}
else
{
Alert.ShowInTop("请选择热处理类型!", MessageBoxIcon.Warning);
return;
}
}
}
if (!string.IsNullOrEmpty(this.txtSch.Text))
{
iso.ISO_Sch = Convert.ToDecimal(this.txtSch.Text);
}
else
{
Alert.ShowInTop("请输入壁厚!", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtDia.Text))
{
iso.ISO_Dia = Convert.ToDecimal(this.txtDia.Text);
}
else
{
Alert.ShowInTop("请输入外径!", MessageBoxIcon.Warning);
return;
}
if (drpJoty_B_Rate.SelectedValue == Const._Null)
{
Alert.ShowInTop("对接焊缝检测比例不能为空!", MessageBoxIcon.Warning);
return;
}
else
{
iso.Joty_B_Rate = drpJoty_B_Rate.SelectedValue;
}
if (drpJoty_Level.SelectedValue == Const._Null)
{
Alert.ShowInTop("对接焊缝合格等级不能为空!", MessageBoxIcon.Warning);
return;
}
else
{
iso.Joty_B_Level = drpJoty_Level.SelectedValue;
}
if (drpJoty_C_Rate.SelectedValue == Const._Null)
{
Alert.ShowInTop("角焊缝检测比例不能为空!", MessageBoxIcon.Warning);
return;
}
else
{
iso.Joty_C_Rate = drpJoty_C_Rate.SelectedValue;
}
if (this.drpJoty_C_Level.SelectedValue== Const._Null)
{
Alert.ShowInTop("角焊缝合格等级不能为空!", MessageBoxIcon.Warning);
return;
}
else
{
iso.Joty_C_Level = drpJoty_C_Level.SelectedValue;
}
if (drpJoty_D_Rate.SelectedValue == Const._Null)
{
Alert.ShowInTop("支管链接接头检测比例不能为空!", MessageBoxIcon.Warning);
return;
}
else
{
iso.Joty_D_Rate = drpJoty_D_Rate.SelectedValue;
}
if (drpJoty_D_Level.SelectedValue== Const._Null)
{
Alert.ShowInTop("支管链接焊缝合格等级不能为空!", MessageBoxIcon.Warning);
return;
}
else
{
iso.Joty_D_Level = drpJoty_D_Level.SelectedValue;
}
if (string.IsNullOrEmpty(this.ISO_ID))
{
string newKeyID = SQLHelper.GetNewID(typeof(Model.HJGL_PW_IsoInfo));
iso.ISO_ID = newKeyID;
BLL.HJGL_PW_IsoInfoService.AddIsoInfo(iso);
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "增加管线信息");
}
else
{
iso.ISO_ID = this.ISO_ID;
var oldIso = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(this.ISO_ID);
if (drpIDName.SelectedValue != oldIso.ISC_ID)
{
var weldControl = BLL.HJGL_WeldControlService.GEtWeldControlByISCIDAndExecStandardId(drpIDName.SelectedValue, this.drpExecStandard.SelectedValue);
var oldJots = from x in Funs.DB.HJGL_PW_JointInfo where x.ISO_ID == this.ISO_ID select x;
if (oldJots.Count() > 0)
{
foreach (var jot in oldJots)
{
var joty = BLL.HJGL_WeldService.GetJointTypeByID(jot.JOTY_ID);
Model.HJGL_PW_JointInfo updateJot = Funs.DB.HJGL_PW_JointInfo.FirstOrDefault(x => x.JOT_ID == jot.JOT_ID);
if (updateJot != null)
{
if (weldControl != null && joty != null)
{
if (joty.JOTY_Group == "1")
{
updateJot.NDTR_ID = weldControl.Joty_Rate;
updateJot.JOT_QualifiedLevel = weldControl.Joty_Level;
}
else if (joty.JOTY_Group == "2")
{
updateJot.NDTR_ID = weldControl.Joty_C_Rate;
updateJot.JOT_QualifiedLevel = weldControl.Joty_C_Level;
}
else if (joty.JOTY_Group == "3")
{
updateJot.NDTR_ID = weldControl.Joty_D_Rate;
updateJot.JOT_QualifiedLevel = weldControl.Joty_D_Level;
}
Funs.DB.SubmitChanges();
}
}
}
}
}
BLL.HJGL_PW_IsoInfoService.UpdateIsoInfo(iso);
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改管线信息");
}
ShowNotify("提交成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
#region
#region
/// <summary>
/// 页索引改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
this.BindGrid();
}
#endregion
#region
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, GridSortEventArgs e)
{
this.BindGrid();
}
#endregion
#region
/// <summary>
/// 分页选择下拉改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue);
this.BindGrid();
}
#endregion
#endregion
#region
/// <summary>
/// 数据绑定
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT JointInfo.ProjectId,JointInfo.ISO_ID,JointInfo.JOT_ID,JointInfo.JOT_JointNo,
JointInfo.JOT_JointAttribute,(CASE WHEN JointInfo.DReportID IS NOT NULL THEN '是' ELSE '否' END) AS Is_hjName,
WeldReportMain.JOT_WeldDate,Welder.WED_Name as WED_Name1,FloorWelder.WED_Name as WED_Name2,
(CASE WHEN bat.PointType='1' THEN '点口' WHEN bat.PointType='2' THEN '扩透' ELSE '' END) AS JointStatusName,
(CASE WHEN (SELECT COUNT(*) FROM dbo.HJGL_CH_TrustItem t WHERE t.JOT_ID=JointInfo.JOT_ID )>0 THEN '已委托' ELSE '未委托' END) AS JOT_TrustFlagName,
(SELECT TOP 1 t.States FROM dbo.HJGL_CH_TrustItem t WHERE t.JOT_ID=JointInfo.JOT_ID ) AS CheckState
FROM HJGL_PW_JointInfo AS JointInfo
LEFT JOIN HJGL_BO_WeldReportMain AS WeldReportMain on WeldReportMain.DReportID=JointInfo.DReportID
LEFT JOIN dbo.HJGL_BO_BatchDetail AS bat ON bat.JOT_ID = JointInfo.JOT_ID
LEFT JOIN HJGL_BS_Welder AS Welder on Welder.WED_ID= JointInfo.JOT_CellWelder
LEFT JOIN HJGL_BS_Welder as FloorWelder on FloorWelder.WED_ID=JointInfo.JOT_FloorWelder
WHERE JointInfo.ProjectId= @ProjectId AND JointInfo.ISO_ID= @ISO_ID";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
listStr.Add(new SqlParameter("@ISO_ID", this.ISO_ID));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
// 2.获取当前分页数据
//var table = this.GetPagedDataTable(Grid1, tb1);
if (tb.Rows.Count > 0)
{
this.Tab2.Hidden = false;
}
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 btnCopy_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.txtISO_IsoNoS.Text.Trim()))
{
var isoInfo = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoNo(this.txtISO_IsoNoS.Text.Trim(), this.CurrUser.LoginProjectId);
if (isoInfo != null)
{
this.txtISO_IsoNo.Text = string.Empty;
if (!string.IsNullOrEmpty(isoInfo.BSU_ID))
{
this.drpBUS_ID.SelectedValue = isoInfo.BSU_ID;
}
if (!string.IsNullOrEmpty(isoInfo.ISC_ID))
{
this.drpIDName.SelectedValue = isoInfo.ISC_ID;
}
if (!string.IsNullOrEmpty(isoInfo.ISO_Executive))
{
this.drpExecStandard.SelectedValue = isoInfo.ISO_Executive;
}
if (!string.IsNullOrEmpty(isoInfo.STE_ID))
{
this.drpSTEName.SelectedValue = isoInfo.STE_ID;
}
if (!string.IsNullOrEmpty(isoInfo.MaterialStandardId))
{
this.drpMaterialStandardId.SelectedValue = isoInfo.MaterialStandardId;
}
if (!string.IsNullOrEmpty(isoInfo.SER_ID))
{
this.drpSER.SelectedValue = isoInfo.SER_ID;
var ser = BLL.HJGL_MediumService.GetServiceBySERID(this.drpSER.SelectedValue);
if (ser != null)
{
this.txtServiceAbbreviate.Text = ser.SER_Abbreviate;
}
}
this.txtPressureTestPackageNo.Text = isoInfo.PressureTestPackageNo;
this.txtISO_Paint.Text = isoInfo.ISO_Paint;
this.txtISO_Insulator.Text = isoInfo.ISO_Insulator;
this.txtOperatingPressure.Text = isoInfo.OperatingPressure;
this.txtOperatingTemperature.Text = isoInfo.OperatingTemperature;
if (!string.IsNullOrEmpty(isoInfo.PipeLineClass))
{
this.drpPipeLineClass.SelectedValue = isoInfo.PipeLineClass;
}
if (isoInfo.PipeLineLength.HasValue)
{
this.txtPipeLineLength.Text = isoInfo.PipeLineLength.ToString();
}
this.txtLeakageTest.Text = isoInfo.LeakageTest;
if (isoInfo.ISO_DesignPress.HasValue)
{
this.txtISO_DesignPress.Text = isoInfo.ISO_DesignPress.ToString();
}
if (isoInfo.ISO_DesignTemperature.HasValue)
{
this.txtISO_DesignTemperature.Text = isoInfo.ISO_DesignTemperature.ToString();
}
if (isoInfo.ISO_TestPress.HasValue)
{
this.txtISO_TestPress.Text = isoInfo.ISO_TestPress.ToString();
}
this.txtTestCategoryNum.Text = isoInfo.TestCategoryNum;
this.txtISO_Remark.Text = isoInfo.ISO_Remark;
if (isoInfo.ISO_Dia != null)
{
this.txtDia.Text = isoInfo.ISO_Dia.ToString();
}
if (isoInfo.ISO_Sch != null)
{
this.txtSch.Text = isoInfo.ISO_Sch.ToString();
}
if (!string.IsNullOrEmpty(isoInfo.Joty_B_Rate))
{
drpJoty_B_Rate.SelectedValue = isoInfo.Joty_B_Rate;
}
if (!string.IsNullOrEmpty(isoInfo.Joty_C_Rate))
{
drpJoty_C_Rate.SelectedValue = isoInfo.Joty_C_Rate;
}
if (!string.IsNullOrEmpty(isoInfo.Joty_D_Rate))
{
drpJoty_D_Rate.SelectedValue = isoInfo.Joty_D_Rate;
}
if (!string.IsNullOrEmpty(isoInfo.Joty_B_Level))
{
drpJoty_Level.SelectedValue = isoInfo.Joty_B_Level;
}
if (!string.IsNullOrEmpty(isoInfo.Joty_C_Level))
{
drpJoty_C_Level.SelectedValue = isoInfo.Joty_C_Level;
}
if (!string.IsNullOrEmpty(isoInfo.Joty_D_Level))
{
drpJoty_D_Level.SelectedValue = isoInfo.Joty_D_Level;
}
//选择管道等级、执行标准时,自动添加对接焊缝检测比例、合格等级、支管连接接头检测比例、合格等级、角焊缝检测比例、合格等级
//var weldControl = BLL.HJGL_WeldControlService.GEtWeldControlByISCIDAndExecStandardId(this.drpIDName.SelectedValue, this.drpExecStandard.SelectedValue);
//if (weldControl != null)
//{
// if (!string.IsNullOrEmpty(weldControl.Joty_Rate))
// {
// var rate = BLL.HJGL_DetectionService.GetNDTRateByNDTRID(weldControl.Joty_Rate);
// if (rate != null)
// {
// this.txtTestCategoryNum.Text = rate.NDTR_Code;
// if (drpJoty_B_Rate.SelectedValue == Const._Null || string.IsNullOrEmpty(drpJoty_B_Rate.SelectedValue))
// {
// drpJoty_B_Rate.SelectedValue = weldControl.Joty_Rate;
// }
// }
// }
// this.txtJoty_Level.Text = weldControl.Joty_Level;
// if (!string.IsNullOrEmpty(weldControl.Joty_C_Rate))
// {
// if (drpJoty_C_Rate.SelectedValue == Const._Null || string.IsNullOrEmpty(drpJoty_C_Rate.SelectedValue))
// {
// drpJoty_C_Rate.SelectedValue = weldControl.Joty_C_Rate;
// }
// }
// this.txtJoty_C_Level.Text = weldControl.Joty_C_Level;
// if (!string.IsNullOrEmpty(weldControl.Joty_D_Rate))
// {
// if (drpJoty_D_Rate.SelectedValue == Const._Null || string.IsNullOrEmpty(drpJoty_D_Rate.SelectedValue))
// {
// drpJoty_D_Rate.SelectedValue = weldControl.Joty_D_Rate;
// }
// }
// this.txtJoty_D_Level.Text = weldControl.Joty_D_Level;
//}
}
else
{
this.txtISO_IsoNo.Text = string.Empty;
this.drpBUS_ID.SelectedValue = BLL.Const._Null;
this.drpIDName.SelectedValue = BLL.Const._Null;
this.drpExecStandard.SelectedValue = BLL.Const._Null;
this.drpSTEName.SelectedValue = BLL.Const._Null;
this.drpMaterialStandardId.SelectedValue = BLL.Const._Null;
this.drpSER.SelectedValue = BLL.Const._Null;
this.txtPressureTestPackageNo.Text = string.Empty;
this.txtISO_Paint.Text = string.Empty;
this.txtISO_Insulator.Text = string.Empty;
this.txtOperatingPressure.Text = string.Empty;
this.txtOperatingTemperature.Text = string.Empty;
this.drpPipeLineClass.SelectedValue = BLL.Const._Null;
this.txtPipeLineLength.Text = string.Empty;
this.txtLeakageTest.Text = string.Empty;
this.txtServiceAbbreviate.Text = string.Empty;
this.txtISO_DesignPress.Text = string.Empty;
this.txtISO_DesignTemperature.Text = string.Empty;
this.txtISO_TestPress.Text = string.Empty;
this.txtTestCategoryNum.Text = string.Empty;
}
}
}
#endregion
#region DropDownList下拉选择
/// <summary>
/// DropDownList下拉选择
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void DrpList_SelectedIndexChanged(object sender, EventArgs e)
{
///选择介质时自动加载介质缩写
var ser = BLL.HJGL_MediumService.GetServiceBySERID(this.drpSER.SelectedValue);
if (ser != null)
{
this.txtServiceAbbreviate.Text = ser.SER_Abbreviate;
}
else
{
this.txtServiceAbbreviate.Text = string.Empty;
}
//选择管道等级、执行标准时,自动添加对接焊缝检测比例、合格等级、支管连接接头检测比例、合格等级、角焊缝检测比例、合格等级
var weldControl = BLL.HJGL_WeldControlService.GEtWeldControlByISCIDAndExecStandardId(this.drpIDName.SelectedValue, this.drpExecStandard.SelectedValue);
if (weldControl != null)
{
if (!string.IsNullOrEmpty(weldControl.Joty_Rate))
{
var rate = BLL.HJGL_DetectionService.GetNDTRateByNDTRID(weldControl.Joty_Rate);
if (rate != null)
{
this.txtTestCategoryNum.Text = rate.NDTR_Code;
}
drpJoty_B_Rate.SelectedValue = weldControl.Joty_Rate;
}
if (!string.IsNullOrEmpty(weldControl.Joty_Level))
{
this.drpJoty_Level.SelectedValue = weldControl.Joty_Level;
}
if (!string.IsNullOrEmpty(weldControl.Joty_C_Rate))
{
drpJoty_C_Rate.SelectedValue = weldControl.Joty_C_Rate;
}
if (!string.IsNullOrEmpty(weldControl.Joty_C_Level))
{
this.drpJoty_C_Level.SelectedValue = weldControl.Joty_C_Level;
}
if (!string.IsNullOrEmpty(weldControl.Joty_D_Rate))
{
drpJoty_D_Rate.SelectedValue = weldControl.Joty_D_Rate;
}
if (!string.IsNullOrEmpty(weldControl.Joty_D_Level))
{
this.drpJoty_D_Level.SelectedValue = weldControl.Joty_D_Level;
}
}
else
{
this.drpJoty_B_Rate.SelectedValue = Const._Null;
drpJoty_Level.SelectedValue = Const._Null;
this.drpJoty_C_Rate.SelectedValue = Const._Null;
this.drpJoty_C_Level.Text = Const._Null;
this.drpJoty_D_Rate.SelectedValue = Const._Null;
this.drpJoty_D_Level.Text = Const._Null;
}
}
/// <summary>
/// 是否显示热处理类型
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpIsHot_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpIsHot.SelectedValue == "1")
{
this.drpIsHotType.Hidden = false;
}
else
{
this.drpIsHotType.Hidden = true;
}
}
#endregion
#region
/// <summary>
/// 选项卡切换事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
{
if (TabStrip1.ActiveTabIndex == 1)
{
this.Form2.Hidden = true;
}
else
{
this.Form2.Hidden = false;
}
}
#endregion
#region
/// <summary>
/// 得到热处理类型
/// </summary>
/// <param name="bigType"></param>
/// <returns></returns>
protected string ConvertCheckState(object checkState)
{
string str = string.Empty;
if (checkState != null)
{
if (checkState.ToString() == "1")
{
str="待检测";
}
if (checkState.ToString() == "2")
{
str = "检测合格";
}
if (checkState.ToString() == "3")
{
str = "待重检";
}
if (checkState.ToString() == "4")
{
str = "待返修";
}
}
return str;
}
#endregion
}
}