PMI委托
This commit is contained in:
@@ -0,0 +1,406 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.WeldingProcess.PMI
|
||||
{
|
||||
public partial class PMIDelegation : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// PMI委托主键
|
||||
/// </summary>
|
||||
public string PMIDelegationId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["PMIDelegationId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["PMIDelegationId"] = 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.PMIDelegationId = string.Empty;
|
||||
this.InitTreeMenu();//加载树
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载树
|
||||
/// <summary>
|
||||
/// 加载树
|
||||
/// </summary>
|
||||
private void InitTreeMenu()
|
||||
{
|
||||
string projectName = string.Empty;
|
||||
var pro = BLL.Base_ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||||
if (pro != null)
|
||||
{
|
||||
this.tvControlItem.Nodes.Clear();
|
||||
TreeNode rootNode = new TreeNode();
|
||||
rootNode.Text = "[" + pro.ProjectCode + "]" + pro.ProjectName;
|
||||
rootNode.NodeID = "0";
|
||||
rootNode.Expanded = true;
|
||||
rootNode.EnableClickEvent = true;
|
||||
this.tvControlItem.Nodes.Add(rootNode);
|
||||
|
||||
List<Model.PMI_Delegation> trustLists = new List<Model.PMI_Delegation>(); ///PMI委托单
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtSearchNo.Text.Trim()))
|
||||
{
|
||||
trustLists = (from x in Funs.DB.PMI_Delegation where x.ProjectId == CurrUser.LoginProjectId && x.DelegationNo.Contains(this.txtSearchNo.Text.Trim()) orderby x.DelegationNo select x).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
trustLists = (from x in Funs.DB.PMI_Delegation where x.ProjectId == CurrUser.LoginProjectId orderby x.DelegationNo select x).ToList();
|
||||
}
|
||||
this.BindNodes(rootNode, trustLists);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 绑定树节点
|
||||
/// <summary>
|
||||
/// 绑定树节点
|
||||
/// </summary>
|
||||
/// <param name="node"></param>
|
||||
private void BindNodes(TreeNode node, List<Model.PMI_Delegation> trustList)
|
||||
{
|
||||
foreach (var item in trustList)
|
||||
{
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = item.DelegationNo;
|
||||
newNode.NodeID = item.Id;
|
||||
newNode.ToolTip = item.DelegationNo;
|
||||
newNode.CommandName = Resources.Lan.RequestSheetNumber;
|
||||
newNode.EnableClickEvent = true;
|
||||
node.Nodes.Add(newNode);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 点击TreeView
|
||||
/// <summary>
|
||||
/// 点击TreeView
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
||||
{
|
||||
if (this.tvControlItem.SelectedNodeID != "0")
|
||||
{
|
||||
this.PMIDelegationId = tvControlItem.SelectedNodeID;
|
||||
this.BindGrid();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DropDownList下拉选择事件
|
||||
/// <summary>
|
||||
/// 项目下拉选择事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.InitTreeMenu();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据绑定
|
||||
/// <summary>
|
||||
/// 数据绑定
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = string.Empty;
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
this.SetTextTemp();
|
||||
this.PageInfoLoad(); ///页面输入提交信息
|
||||
|
||||
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
||||
{
|
||||
var result = Funs.DB.PMI_Delegation.FirstOrDefault(t=>t.Id==this.tvControlItem.SelectedNodeID);
|
||||
if (result != null)
|
||||
{
|
||||
this.PMIDelegationId = result.Id;
|
||||
strSql = @"SELECT * "
|
||||
+ @" FROM dbo.View_HotProess_TrustItem AS Trust"
|
||||
+ @" WHERE Trust.ProjectId= @ProjectId AND Trust.HotProessTrustId=@HotProessTrustId ";
|
||||
|
||||
listStr.Add(new SqlParameter("@ProjectId", result != null ? result.ProjectId : this.CurrUser.LoginProjectId));
|
||||
listStr.Add(new SqlParameter("@HotProessTrustId", this.PMIDelegationId));
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtIsoNo.Text.Trim()))
|
||||
{
|
||||
strSql += @" and Trust.PipelineCode like '%'+@PipelineCode+'%' ";
|
||||
listStr.Add(new SqlParameter("@PipelineCode", this.txtIsoNo.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.BindGrid();
|
||||
}
|
||||
|
||||
#region 加载页面输入提交信息
|
||||
/// <summary>
|
||||
/// 加载页面输入提交信息
|
||||
/// </summary>
|
||||
private void PageInfoLoad()
|
||||
{
|
||||
var trust =Funs.DB.PMI_Delegation.FirstOrDefault(t=>t.Id==this.PMIDelegationId);
|
||||
if (trust != null)
|
||||
{
|
||||
this.txtDelegationNo.Text = trust.DelegationNo;
|
||||
if (trust.DelegationDate.HasValue)
|
||||
{
|
||||
this.txtDelegationDate.Text = string.Format("{0:yyyy-MM-dd}", trust.DelegationDate);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(trust.InstallationId))
|
||||
{
|
||||
this.txtInstallationName.Text = BLL.Project_InstallationService.GetProject_InstallationNameByInstallationId(trust.InstallationId);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(trust.UnitId))
|
||||
{
|
||||
this.txtUnitName.Text = BLL.Base_UnitService.GetUnitNameByUnitId(trust.UnitId);
|
||||
}
|
||||
this.txtDetectionMethod.Text = "PMI光谱分析";
|
||||
this.txtDetectionStandard.Text = trust.DetectionStandard;
|
||||
if (!string.IsNullOrEmpty(trust.Tabler))
|
||||
{
|
||||
this.txtTabler.Text = BLL.Sys_UserService.GetUserNameByUserId(trust.Tabler);
|
||||
}
|
||||
this.txtRemark.Text = trust.Remark;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 清空文本
|
||||
/// <summary>
|
||||
/// 清空文本
|
||||
/// </summary>
|
||||
private void SetTextTemp()
|
||||
{
|
||||
this.txtDelegationNo.Text = string.Empty;
|
||||
this.txtDelegationDate.Text = string.Empty;
|
||||
this.txtInstallationName.Text = string.Empty;
|
||||
this.txtUnitName.Text = string.Empty;
|
||||
this.txtDetectionMethod.Text = string.Empty;
|
||||
this.txtDetectionStandard.Text = string.Empty;
|
||||
this.txtTabler.Text = string.Empty;
|
||||
this.txtRemark.Text = string.Empty;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 分页排序
|
||||
#region 页索引改变事件
|
||||
/// <summary>
|
||||
/// 页索引改变事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 排序
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
||||
{
|
||||
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
|
||||
#endregion
|
||||
|
||||
#region PMI委托 维护事件
|
||||
/// <summary>
|
||||
/// 增加PMI委托
|
||||
/// </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.PMIDelegationId, Const.BtnAdd))
|
||||
{
|
||||
this.SetTextTemp();
|
||||
string window = String.Format("PMIDelegationEdit.aspx?PMIDelegationId={0}", string.Empty, "新增 - ");
|
||||
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(this.PMIDelegationId)
|
||||
+ Window1.GetShowReference(window));
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
#region 编辑PMI委托
|
||||
/// <summary>
|
||||
/// 编辑PMI委托
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HotProessTrustMenuId, Const.BtnSave))
|
||||
{
|
||||
var trustManage = Funs.DB.PMI_Delegation.FirstOrDefault (t=>t.Id==this.PMIDelegationId);
|
||||
if (trustManage != null)
|
||||
{
|
||||
string window = String.Format("HotProessTrustEdit.aspx?HotProessTrustId={0}", this.PMIDelegationId, "编辑 - ");
|
||||
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(this.PMIDelegationId)
|
||||
+ Window1.GetShowReference(window));
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify(Resources.Lan.PleaseSelectModifyHotProessTrust, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除PMI委托
|
||||
/// <summary>
|
||||
/// 删除PMI委托
|
||||
/// </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.PMIDelegationId, Const.BtnDelete))
|
||||
{
|
||||
var trustManage =Funs.DB.PMI_Delegation.FirstOrDefault (t=>t.Id==this.PMIDelegationId);
|
||||
if (trustManage != null)
|
||||
{
|
||||
//删除主表数据
|
||||
Funs.DB.PMI_Delegation.DeleteOnSubmit(trustManage);
|
||||
//删除 明细表
|
||||
|
||||
Funs.DB.SubmitChanges();
|
||||
Alert.ShowInTop(Resources.Lan.DeletedSuccessfully, MessageBoxIcon.Success);
|
||||
this.InitTreeMenu();
|
||||
SetTextTemp();
|
||||
this.Grid1.DataSource = null;
|
||||
this.Grid1.DataBind();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify(Resources.Lan.PleaseSelectDeleteHotProessTrust, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 关闭弹出窗口及刷新页面
|
||||
/// <summary>
|
||||
/// 关闭弹出窗口
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
this.InitTreeMenu();
|
||||
this.BindGrid();
|
||||
|
||||
}
|
||||
|
||||
#region 查询
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Tree_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.InitTreeMenu();
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 右键编辑热处理报告
|
||||
/// <summary>
|
||||
/// 热处理报告
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuHotProessReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HotProessTrustMenuId, Const.BtnSave))
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("HotProessReport.aspx?HotProessTrustItemId={0}", this.Grid1.SelectedRowID, "编辑热处理报告 - ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user