266 lines
12 KiB
C#
266 lines
12 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using BLL;
|
|
using System.Data;
|
|
|
|
namespace FineUIPro.Web.HJGL.WeldingManage
|
|
{
|
|
public partial class SelectWeldingProcedure : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 焊接工艺评定材质匹配ID
|
|
/// </summary>
|
|
private string MatchedProcedureMaterialId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["MatchedProcedureMaterialId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["MatchedProcedureMaterialId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载页面
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|
// 绑定表格
|
|
BindGrid();
|
|
this.MatchedProcedureMaterialId = Request.Params["MatchedProcedureMaterialId"];
|
|
if (!string.IsNullOrEmpty(this.MatchedProcedureMaterialId))
|
|
{
|
|
var viewMatchedProcedureMaterial = BLL.HJGL_MatchedProcedureMaterialService.GetMatchedProcedureMaterialViewById(this.MatchedProcedureMaterialId);
|
|
if (viewMatchedProcedureMaterial != null)
|
|
{
|
|
this.txtMaterialClass1.Text = viewMatchedProcedureMaterial.MaterialClass1;
|
|
this.txtMaterialGroup1.Text = viewMatchedProcedureMaterial.MaterialGroup1;
|
|
this.txtSTE_Name1.Text = viewMatchedProcedureMaterial.STE_Name1;
|
|
this.txtMaterialClass2.Text = viewMatchedProcedureMaterial.MaterialClass2;
|
|
this.txtMaterialGroup2.Text = viewMatchedProcedureMaterial.MaterialGroup2;
|
|
this.txtSTE_Name2.Text = viewMatchedProcedureMaterial.STE_Name2;
|
|
this.txtWME_Code.Text = viewMatchedProcedureMaterial.WME_Name;
|
|
this.txtThickness.Text = viewMatchedProcedureMaterial.Thickness.ToString();
|
|
this.txtDia.Text = viewMatchedProcedureMaterial.Dia.ToString();
|
|
this.txtIsHotTreatment.Text = viewMatchedProcedureMaterial.IsHotTreatmentName;
|
|
this.txtWeldingPosition.Text = viewMatchedProcedureMaterial.WeldingPosition;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
string strSql = "SELECT WeldingProcedure.WeldingProcedureId"
|
|
+ @",WeldingProcedure.WeldingProcedureCode"
|
|
+ @",WeldingProcedure.MaterialClass1"
|
|
+ @",WeldingProcedure.MaterialGroup1"
|
|
+ @",WeldingProcedure.STE_Name1"
|
|
+ @",WeldingProcedure.MaterialClass2"
|
|
+ @",WeldingProcedure.MaterialGroup2"
|
|
+ @",WeldingProcedure.STE_Name2"
|
|
+ @",WeldingProcedure.Specifications"
|
|
+ @",WeldingProcedure.WeldMethodName"
|
|
+ @",WeldingProcedure.MinImpactDia"
|
|
+ @",WeldingProcedure.MaxImpactDia"
|
|
+ @",WeldingProcedure.MinImpactThickness"
|
|
+ @",WeldingProcedure.MaxImpactThickness"
|
|
+ @",WeldingProcedure.NoMinImpactThickness"
|
|
+ @",WeldingProcedure.NoMaxImpactThickness"
|
|
+ @",WeldingProcedure.WeldingPosition"
|
|
+ @",WeldingProcedure.IsHotTreatmentName"
|
|
+ @",WeldingProcedure.StandardCode"
|
|
+ @" FROM HJGL_View_WeldingProcedure AS WeldingProcedure "
|
|
+ @" WHERE 1=1 ";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
if (!string.IsNullOrEmpty(this.txtStandardCode.Text.Trim()))
|
|
{
|
|
strSql += " AND WeldingProcedure.StandardCode LIKE @StandardCode";
|
|
listStr.Add(new SqlParameter("@StandardCode", "%" + this.txtStandardCode.Text.Trim() + "%"));
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtWeldingProcedureCode.Text.Trim()))
|
|
{
|
|
strSql += " AND WeldingProcedure.WeldingProcedureCode LIKE @WeldingProcedureCode";
|
|
listStr.Add(new SqlParameter("@WeldingProcedureCode", "%" + this.txtWeldingProcedureCode.Text.Trim() + "%"));
|
|
}
|
|
if (this.ckMaterialClass1.Checked == true)
|
|
{
|
|
strSql += " AND WeldingProcedure.MaterialClass1 LIKE @MaterialClass1";
|
|
listStr.Add(new SqlParameter("@MaterialClass1", "%" + this.txtMaterialClass1.Text.Trim() + "%"));
|
|
}
|
|
if (this.ckMaterialGroup1.Checked == true)
|
|
{
|
|
strSql += " AND WeldingProcedure.MaterialGroup1 LIKE @MaterialGroup1";
|
|
listStr.Add(new SqlParameter("@MaterialGroup1", "%" + this.txtMaterialGroup1.Text.Trim() + "%"));
|
|
}
|
|
if (this.ckSTE_Name1.Checked == true)
|
|
{
|
|
strSql += " AND WeldingProcedure.STE_Name1 LIKE @STE_Name1";
|
|
listStr.Add(new SqlParameter("@STE_Name1", "%" + this.txtSTE_Name1.Text.Trim() + "%"));
|
|
}
|
|
if (this.ckMaterialClass2.Checked == true)
|
|
{
|
|
strSql += " AND WeldingProcedure.MaterialClass2 LIKE @MaterialClass2";
|
|
listStr.Add(new SqlParameter("@MaterialClass2", "%" + this.txtMaterialClass2.Text.Trim() + "%"));
|
|
}
|
|
if (this.ckMaterialGroup2.Checked == true)
|
|
{
|
|
strSql += " AND WeldingProcedure.MaterialGroup2 LIKE @MaterialGroup2";
|
|
listStr.Add(new SqlParameter("@MaterialGroup2", "%" + this.txtMaterialGroup2.Text.Trim() + "%"));
|
|
}
|
|
if (this.ckSTE_Name2.Checked == true)
|
|
{
|
|
strSql += " AND WeldingProcedure.STE_Name2 LIKE @STE_Name2";
|
|
listStr.Add(new SqlParameter("@STE_Name2", "%" + this.txtSTE_Name2.Text.Trim() + "%"));
|
|
}
|
|
if (this.ckThickness.Checked == true)//适用厚度范围
|
|
{
|
|
if (this.ckImpact.Checked == true)//是否冲击
|
|
{
|
|
strSql += " AND ((WeldingProcedure.MaxImpactThickness IS NOT NULL AND WeldingProcedure.MinImpactThickness <= @Thickness) OR (WeldingProcedure.MinImpactThickness IS NOT NULL AND WeldingProcedure.MaxImpactThickness >= @Thickness) OR(WeldingProcedure.MaxImpactThickness >= @Thickness AND WeldingProcedure.MinImpactThickness <= @Thickness))";
|
|
listStr.Add(new SqlParameter("@Thickness", this.txtThickness.Text.Trim()));
|
|
}
|
|
else
|
|
{
|
|
strSql += " AND ((WeldingProcedure.NoMaxImpactThickness IS NOT NULL AND WeldingProcedure.NoMinImpactThickness <= @Thickness) OR (WeldingProcedure.NoMinImpactThickness IS NOT NULL AND WeldingProcedure.NoMaxImpactThickness >= @Thickness) OR(WeldingProcedure.NoMaxImpactThickness >= @Thickness AND WeldingProcedure.NoMinImpactThickness <= @Thickness))";
|
|
listStr.Add(new SqlParameter("@Thickness", this.txtThickness.Text.Trim()));
|
|
}
|
|
}
|
|
if (this.ckbDia.Checked == true)//适用外径范围
|
|
{
|
|
strSql += " AND ((WeldingProcedure.MaxImpactDia IS NOT NULL AND WeldingProcedure.MinImpactDia <= @Dia) OR (WeldingProcedure.MinImpactDia IS NOT NULL AND WeldingProcedure.MaxImpactDia >= @Dia) OR (WeldingProcedure.MaxImpactDia >= @Dia AND WeldingProcedure.MinImpactDia <= @Dia))";
|
|
listStr.Add(new SqlParameter("@Dia", this.txtDia.Text.Trim()));
|
|
}
|
|
if (this.ckWeldingPosition.Checked == true)//焊接位置
|
|
{
|
|
strSql += " AND WeldingProcedure.WeldingPosition LIKE @WeldingPosition";
|
|
listStr.Add(new SqlParameter("@WeldingPosition", "%" + this.txtWeldingPosition.Text.Trim() + "%"));
|
|
}
|
|
if (this.ckWME_Code.Checked == true)//焊接方法
|
|
{
|
|
strSql += " AND WeldingProcedure.WeldMethodName LIKE @WeldMethodName";
|
|
listStr.Add(new SqlParameter("@WeldMethodName", "%" + this.txtWME_Code.Text.Trim() + "%"));
|
|
}
|
|
if (this.ckIsHotTreatment.Checked == true)//焊后热处理
|
|
{
|
|
strSql += " AND WeldingProcedure.IsHotTreatmentName = @IsHotTreatmentName";
|
|
listStr.Add(new SqlParameter("@IsHotTreatmentName", this.txtIsHotTreatment.Text.Trim()));
|
|
}
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
#endregion
|
|
|
|
#region 表头过滤
|
|
protected void Grid1_FilterChange(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 页索引改变事件
|
|
/// <summary>
|
|
/// 页索引改变事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
Grid1.PageIndex = e.NewPageIndex;
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 排序
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
Grid1.SortDirection = e.SortDirection;
|
|
Grid1.SortField = e.SortField;
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 分页选择下拉改变事件
|
|
/// <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();
|
|
}
|
|
#endregion
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 编辑
|
|
/// <summary>
|
|
/// 编辑按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuSelect_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string id = Grid1.SelectedRowID;
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
var weldingProcedure = HJGL_WeldingManage_WeldingProcedureService.GetWeldingProcedureById(id);
|
|
if (weldingProcedure != null)
|
|
{
|
|
var matchedProcedureMaterial = BLL.HJGL_MatchedProcedureMaterialService.GetMatchedProcedureMaterialById(this.MatchedProcedureMaterialId);
|
|
if (matchedProcedureMaterial != null)
|
|
{
|
|
matchedProcedureMaterial.WeldingProcedureId = weldingProcedure.WeldingProcedureId;
|
|
BLL.HJGL_MatchedProcedureMaterialService.UpdateMatchedProcedureMaterial(matchedProcedureMaterial);
|
|
Alert.ShowInTop("匹配成功!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |