444 lines
18 KiB
C#
444 lines
18 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BLL;
|
|
using System.Data.SqlClient;
|
|
using System.Data;
|
|
|
|
namespace FineUIPro.Web.HJGLServer.BaseInfo
|
|
{
|
|
public partial class WeldControl : PageBase
|
|
{
|
|
#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();
|
|
|
|
this.drpExecStandardId.DataTextField = "ExecStandardName";
|
|
this.drpExecStandardId.DataValueField = "ExecStandardId";
|
|
this.drpExecStandardId.DataSource = BLL.HJGL_ExecStandardService.GetExecStandardNameList();
|
|
this.drpExecStandardId.DataBind();
|
|
Funs.FineUIPleaseSelect(drpExecStandardId);
|
|
|
|
this.drpISC_ID.DataTextField = "ISC_IsoName";
|
|
this.drpISC_ID.DataValueField = "ISC_ID";
|
|
this.drpISC_ID.DataSource = BLL.HJGL_PipingClassService.GetIsoClassNameList();
|
|
this.drpISC_ID.DataBind();
|
|
Funs.FineUIPleaseSelect(drpISC_ID);
|
|
|
|
this.drpJoty_Rate.DataTextField = "NDTR_Rate";
|
|
this.drpJoty_Rate.DataValueField = "NDTR_ID";
|
|
this.drpJoty_Rate.DataSource = BLL.HJGL_DetectionService.GetNDTRateNameList();
|
|
this.drpJoty_Rate.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpJoty_Rate);
|
|
|
|
this.drpJoty_C_Rate.DataTextField = "NDTR_Rate";
|
|
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_Rate";
|
|
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);
|
|
|
|
// 绑定表格
|
|
BindGrid();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 绑定数据
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
string strSql = @"SELECT WeldControl.WeldControlId"
|
|
+ @", WeldControl.ExecStandardId"
|
|
+ @", WeldControl.ISC_ID"
|
|
+ @", WeldControl.JotyId"
|
|
+ @", WeldControl.Joty_Rate"
|
|
+ @", Rate1.NDTR_Name AS Joty_RateName"
|
|
+ @", WeldControl.Joty_Level"
|
|
+ @", WeldControl.JotyId_C"
|
|
+ @", WeldControl.Joty_C_Rate"
|
|
+ @", Rate2.NDTR_Name AS Joty_C_RateName"
|
|
+ @", WeldControl.Joty_C_Level"
|
|
+ @", WeldControl.JotyId_D"
|
|
+ @", WeldControl.Joty_D_Rate"
|
|
+ @", Rate3.NDTR_Name AS Joty_D_RateName"
|
|
+ @", WeldControl.Joty_D_Level"
|
|
+ @", ExecStandard.ExecStandardName"
|
|
+ @", IsoClass.ISC_IsoName"
|
|
+ @" FROM HJGL_BS_WeldControl AS WeldControl"
|
|
+ @" LEFT JOIN HJGL_BS_ExecStandard AS ExecStandard ON ExecStandard.ExecStandardId = WeldControl.ExecStandardId "
|
|
+ @" LEFT JOIN HJGL_BS_IsoClass AS IsoClass ON IsoClass.ISC_ID = WeldControl.ISC_ID "
|
|
+ @" LEFT JOIN HJGL_BS_NDTRate AS Rate1 ON Rate1.NDTR_ID = WeldControl.Joty_Rate "
|
|
+ @" LEFT JOIN HJGL_BS_NDTRate AS Rate2 ON Rate2.NDTR_ID = WeldControl.Joty_C_Rate "
|
|
+ @" LEFT JOIN HJGL_BS_NDTRate AS Rate3 ON Rate3.NDTR_ID = WeldControl.Joty_D_Rate "
|
|
+ @" WHERE 1=1";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
if (!string.IsNullOrEmpty(this.txtExecStandardNameS.Text.Trim()))
|
|
{
|
|
strSql += " AND ExecStandard.ExecStandardName LIKE @ExecStandardName";
|
|
listStr.Add(new SqlParameter("@ExecStandardName", "%" + this.txtExecStandardNameS.Text.Trim() + "%"));
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtISC_IsoNameS.Text.Trim()))
|
|
{
|
|
strSql += " AND IsoClass.ISC_IsoName LIKE @ISC_IsoName";
|
|
listStr.Add(new SqlParameter("@ISC_IsoName", "%" + this.txtISC_IsoNameS.Text.Trim() + "%"));
|
|
}
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
// 2.获取当前分页数据
|
|
//var table = this.GetPagedDataTable(Grid1, 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_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
Grid1.PageIndex = e.NewPageIndex;
|
|
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();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_FilterChange(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, FineUIPro.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 btnDelete_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_WeldControlMenuId, Const.BtnDelete))
|
|
{
|
|
if (judgementDelete(hfFormID.Text, true))
|
|
{
|
|
BLL.HJGL_WeldControlService.DeleteWeldControlById(hfFormID.Text);
|
|
BLL.Sys_LogService.AddLog(BLL.Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除焊缝检测比例对照表");
|
|
// 重新绑定表格,并模拟点击[新增按钮]
|
|
BindGrid();
|
|
PageContext.RegisterStartupScript("onNewButtonClick();");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
/// <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_WeldControlMenuId, Const.BtnDelete))
|
|
{
|
|
this.DeleteData();
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除方法
|
|
/// </summary>
|
|
private void DeleteData()
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length > 0)
|
|
{
|
|
bool isShow = true;
|
|
if (Grid1.SelectedRowIndexArray.Length > 1)
|
|
{
|
|
isShow = false;
|
|
}
|
|
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|
{
|
|
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
|
if (judgementDelete(rowID, isShow))
|
|
{
|
|
BLL.HJGL_WeldControlService.DeleteWeldControlById(rowID);
|
|
BLL.Sys_LogService.AddLog(BLL.Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除焊缝检测比例对照表");
|
|
Alert.ShowInTop("删除完成!", MessageBoxIcon.Success);
|
|
}
|
|
}
|
|
|
|
BindGrid();
|
|
PageContext.RegisterStartupScript("onNewButtonClick();");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 编辑
|
|
/// <summary>
|
|
/// 右键编辑事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_WeldControlMenuId, Const.BtnModify))
|
|
{
|
|
this.EditData();
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编辑数据方法
|
|
/// </summary>
|
|
private void EditData()
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string Id = Grid1.SelectedRowID;
|
|
var weldControl = BLL.HJGL_WeldControlService.GetWeldControlById(Id);
|
|
if (weldControl != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(weldControl.ExecStandardId))
|
|
{
|
|
this.drpExecStandardId.SelectedValue = weldControl.ExecStandardId;
|
|
}
|
|
if (!string.IsNullOrEmpty(weldControl.ISC_ID))
|
|
{
|
|
this.drpISC_ID.SelectedValue = weldControl.ISC_ID;
|
|
}
|
|
if (!string.IsNullOrEmpty(weldControl.Joty_Rate))
|
|
{
|
|
this.drpJoty_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))
|
|
{
|
|
this.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))
|
|
{
|
|
this.drpJoty_D_Rate.SelectedValue = weldControl.Joty_D_Rate;
|
|
}
|
|
if (!string.IsNullOrEmpty(weldControl.Joty_D_Level))
|
|
{
|
|
this.drpJoty_D_Level.SelectedValue = weldControl.Joty_D_Level;
|
|
}
|
|
hfFormID.Text = Id;
|
|
this.btnDelete.Enabled = true;
|
|
}
|
|
}
|
|
#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_WeldControlMenuId, Const.BtnSave))
|
|
{
|
|
string strRowID = hfFormID.Text;
|
|
Model.HJGL_BS_WeldControl newWeldControl = new Model.HJGL_BS_WeldControl();
|
|
if (this.drpExecStandardId.SelectedValue != BLL.Const._Null)
|
|
{
|
|
newWeldControl.ExecStandardId = this.drpExecStandardId.SelectedValue;
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择执行标准", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (this.drpISC_ID.SelectedValue != BLL.Const._Null)
|
|
{
|
|
newWeldControl.ISC_ID = this.drpISC_ID.SelectedValue;
|
|
}
|
|
if (this.drpJoty_Rate.SelectedValue != BLL.Const._Null)
|
|
{
|
|
newWeldControl.Joty_Rate = this.drpJoty_Rate.SelectedValue;
|
|
}
|
|
if (this.drpJoty_Level.SelectedValue != BLL.Const._Null)
|
|
{
|
|
newWeldControl.Joty_Level = this.drpJoty_Level.SelectedValue;
|
|
}
|
|
if (this.drpJoty_C_Rate.SelectedValue != BLL.Const._Null)
|
|
{
|
|
newWeldControl.Joty_C_Rate = this.drpJoty_C_Rate.SelectedValue;
|
|
}
|
|
if (this.drpJoty_C_Level.SelectedValue != BLL.Const._Null)
|
|
{
|
|
newWeldControl.Joty_C_Level = this.drpJoty_C_Level.SelectedValue;
|
|
}
|
|
if (this.drpJoty_D_Rate.SelectedValue != BLL.Const._Null)
|
|
{
|
|
newWeldControl.Joty_D_Rate = this.drpJoty_D_Rate.SelectedValue;
|
|
}
|
|
if (this.drpJoty_D_Level.SelectedValue != BLL.Const._Null)
|
|
{
|
|
newWeldControl.Joty_D_Level = this.drpJoty_D_Level.SelectedValue;
|
|
}
|
|
if (!string.IsNullOrEmpty(strRowID))
|
|
{
|
|
newWeldControl.WeldControlId = strRowID;
|
|
BLL.HJGL_WeldControlService.UpdateWeldControl(newWeldControl);
|
|
BLL.Sys_LogService.AddLog(BLL.Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改焊缝检测比例对照表");
|
|
}
|
|
else
|
|
{
|
|
newWeldControl.WeldControlId = SQLHelper.GetNewID(typeof(Model.HJGL_BS_WeldControl));
|
|
BLL.HJGL_WeldControlService.AddWeldControl(newWeldControl);
|
|
BLL.Sys_LogService.AddLog(BLL.Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加焊缝检测比例对照表");
|
|
}
|
|
|
|
// 重新绑定表格,并点击当前编辑或者新增的行
|
|
BindGrid();
|
|
|
|
Alert.ShowInTop("提交成功!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript("onNewButtonClick();");
|
|
//PageContext.RegisterStartupScript(String.Format("F('{0}').selectRow('{1}');", Grid1.ClientID, UnitQualitySort.UnitQualitySortId));
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 判断是否可删除
|
|
/// <summary>
|
|
/// 判断是否可以删除
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private bool judgementDelete(string id, bool isShow)
|
|
{
|
|
string content = string.Empty;
|
|
//if (BLL.HJGL_PW_IsoInfoService.GetIsoInfoByNDTID(id) > 0)
|
|
//{
|
|
// content = "管线中已经使用了该探伤类型,不能删除!";
|
|
//}
|
|
|
|
//if (BLL.HJGL_PW_JointInfoService.GetJointInfoByRepairID1(id) > 0)
|
|
//{
|
|
// content = "焊口中已经使用该探伤类型,不能删除!";
|
|
//}
|
|
if (string.IsNullOrEmpty(content))
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
if (isShow)
|
|
{
|
|
Alert.ShowInTop(content, MessageBoxIcon.Error);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
}
|
|
} |