1127 lines
46 KiB
C#
1127 lines
46 KiB
C#
using BLL;
|
||
using System;
|
||
using NPOI.XSSF.UserModel;
|
||
using System.Collections.Generic;
|
||
using System.Collections.Specialized;
|
||
using System.Data;
|
||
using System.Data.SqlClient;
|
||
using System.Linq;
|
||
using System.IO;
|
||
using System.Text;
|
||
|
||
namespace FineUIPro.Web.Design
|
||
{
|
||
public partial class DesignInput : PageBase
|
||
{
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
// 表头过滤
|
||
FilterDataRowItem = FilterDataRowItemImplement;
|
||
if (!IsPostBack)
|
||
{
|
||
//GetButtonPower();//权限设置
|
||
|
||
//项目类型
|
||
this.drpJobType.DataTextField = "ConstText";
|
||
this.drpJobType.DataValueField = "ConstValue";
|
||
this.drpJobType.DataSource = BLL.ConstService.GetConstListByGroupId(BLL.Const.ProjectPlanner_JobType);
|
||
this.drpJobType.DataBind();
|
||
Funs.FineUIPleaseSelectJobType(this.drpJobType);
|
||
|
||
//项目状态
|
||
this.drpJobStatus.DataTextField = "ConstText";
|
||
this.drpJobStatus.DataValueField = "ConstValue";
|
||
this.drpJobStatus.DataSource = BLL.ConstService.GetConstListByGroupId(BLL.Const.ProjectPlanner_JobStatus);
|
||
this.drpJobStatus.DataBind();
|
||
Funs.FineUIPleaseSelectJobStatus(this.drpJobStatus);
|
||
|
||
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||
|
||
// 绑定表格
|
||
BindGrid();
|
||
//BindGrid2();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 绑定数据
|
||
/// </summary>
|
||
private void BindGrid()
|
||
{
|
||
string strSql = @"SELECT EProjectId,e.ProjectControl_JobNo,
|
||
e.ProjectControl_JobType,e.ProjectControl_JobStatus,
|
||
e.ProjectControl_JobTitle,e.ProjectControl_BUCode,
|
||
(CASE WHEN (SELECT COUNT(*) FROM dbo.Design_Input input WHERE input.EProjectId=e.EProjectId) =
|
||
(SELECT COUNT(*) FROM dbo.Design_Input input WHERE input.EProjectId=e.EProjectId AND input.IsComplete=1)
|
||
AND (SELECT COUNT(*) FROM dbo.Design_Input input WHERE input.EProjectId=e.EProjectId)>0
|
||
THEN 1 ELSE 0 end) AS DesignInputCompleted
|
||
FROM dbo.Editor_EProject e WHERE 1=1 ";
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
if (this.drpJobType.SelectedValue != BLL.Const._Null)
|
||
{
|
||
strSql += " AND e.ProjectControl_JobType=@JobType ";
|
||
listStr.Add(new SqlParameter("@JobType", this.drpJobType.SelectedItem.Text));
|
||
}
|
||
if (this.drpJobStatus.SelectedValue != BLL.Const._Null && this.drpJobStatus.SelectedValue != null)
|
||
{
|
||
strSql += " AND e.ProjectControl_JobStatus=@Status ";
|
||
listStr.Add(new SqlParameter("@Status", this.drpJobStatus.SelectedItem.Text));
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtJobNO.Text.Trim()))
|
||
{
|
||
strSql += " AND e.ProjectControl_JobNo LIKE @jobNO ";
|
||
listStr.Add(new SqlParameter("@jobNO", this.txtJobNO.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();
|
||
}
|
||
|
||
#region 过滤表头
|
||
/// <summary>
|
||
/// 过滤表头
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_FilterChange(object sender, EventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据表头信息过滤列表数据
|
||
/// </summary>
|
||
/// <param name="sourceObj"></param>
|
||
/// <param name="fillteredOperator"></param>
|
||
/// <param name="fillteredObj"></param>
|
||
/// <param name="column"></param>
|
||
/// <returns></returns>
|
||
private bool FilterDataRowItemImplement(object sourceObj, string fillteredOperator, object fillteredObj, string column)
|
||
{
|
||
bool valid = false;
|
||
if (column == "ProjectControl_JobNo")
|
||
{
|
||
string sourceValue = sourceObj.ToString();
|
||
string fillteredValue = fillteredObj.ToString();
|
||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||
{
|
||
valid = true;
|
||
}
|
||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||
{
|
||
valid = true;
|
||
}
|
||
}
|
||
if (column == "ProjectControl_JobType")
|
||
{
|
||
string sourceValue = sourceObj.ToString();
|
||
string fillteredValue = fillteredObj.ToString();
|
||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||
{
|
||
valid = true;
|
||
}
|
||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||
{
|
||
valid = true;
|
||
}
|
||
}
|
||
if (column == "ProjectControl_JobTitle")
|
||
{
|
||
string sourceValue = sourceObj.ToString();
|
||
string fillteredValue = fillteredObj.ToString();
|
||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||
{
|
||
valid = true;
|
||
}
|
||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||
{
|
||
valid = true;
|
||
}
|
||
}
|
||
if (column == "ProjectControl_JobStatus")
|
||
{
|
||
string sourceValue = sourceObj.ToString();
|
||
string fillteredValue = fillteredObj.ToString();
|
||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||
{
|
||
valid = true;
|
||
}
|
||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||
{
|
||
valid = true;
|
||
}
|
||
}
|
||
if (column == "ProjectControl_BUCode")
|
||
{
|
||
string sourceValue = sourceObj.ToString();
|
||
string fillteredValue = fillteredObj.ToString();
|
||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||
{
|
||
valid = true;
|
||
}
|
||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||
{
|
||
valid = true;
|
||
}
|
||
}
|
||
|
||
// grid2,grid3
|
||
if (column == "DesignInputName")
|
||
{
|
||
string sourceValue = sourceObj.ToString();
|
||
string fillteredValue = fillteredObj.ToString();
|
||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||
{
|
||
valid = true;
|
||
}
|
||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||
{
|
||
valid = true;
|
||
}
|
||
}
|
||
|
||
if (column == "DesignInputNo")
|
||
{
|
||
string sourceValue = sourceObj.ToString();
|
||
string fillteredValue = fillteredObj.ToString();
|
||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||
{
|
||
valid = true;
|
||
}
|
||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||
{
|
||
valid = true;
|
||
}
|
||
}
|
||
|
||
if (column == "IssuedDiscipline")
|
||
{
|
||
string sourceValue = sourceObj.ToString();
|
||
string fillteredValue = fillteredObj.ToString();
|
||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||
{
|
||
valid = true;
|
||
}
|
||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||
{
|
||
valid = true;
|
||
}
|
||
}
|
||
|
||
if (column == "IssuedMan")
|
||
{
|
||
string sourceValue = sourceObj.ToString();
|
||
string fillteredValue = fillteredObj.ToString();
|
||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||
{
|
||
valid = true;
|
||
}
|
||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||
{
|
||
valid = true;
|
||
}
|
||
}
|
||
|
||
if (column == "ReceivedDiscipline")
|
||
{
|
||
string sourceValue = sourceObj.ToString();
|
||
string fillteredValue = fillteredObj.ToString();
|
||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||
{
|
||
valid = true;
|
||
}
|
||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||
{
|
||
valid = true;
|
||
}
|
||
}
|
||
|
||
if (column == "ReceivedMan")
|
||
{
|
||
string sourceValue = sourceObj.ToString();
|
||
string fillteredValue = fillteredObj.ToString();
|
||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||
{
|
||
valid = true;
|
||
}
|
||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||
{
|
||
valid = true;
|
||
}
|
||
}
|
||
|
||
// grid3
|
||
if (column == "MutualIssuedNo")
|
||
{
|
||
string sourceValue = sourceObj.ToString();
|
||
string fillteredValue = fillteredObj.ToString();
|
||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||
{
|
||
valid = true;
|
||
}
|
||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||
{
|
||
valid = true;
|
||
}
|
||
}
|
||
|
||
if (column == "MutualIssuedName")
|
||
{
|
||
string sourceValue = sourceObj.ToString();
|
||
string fillteredValue = fillteredObj.ToString();
|
||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||
{
|
||
valid = true;
|
||
}
|
||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||
{
|
||
valid = true;
|
||
}
|
||
}
|
||
|
||
return valid;
|
||
}
|
||
#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_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
||
{
|
||
Grid1.SortDirection = e.SortDirection;
|
||
Grid1.SortField = e.SortField;
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region 查询
|
||
protected void drpJobType_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
this.drpJobStatus.Items.Clear();
|
||
if (drpJobType.SelectedText == "Other")
|
||
{
|
||
BLL.ConstService.InitConstValueProjectStatus(this.drpJobStatus, BLL.Const.ProjectPlanner_JobStatus, "3", true);
|
||
}
|
||
if (drpJobType.SelectedText != "Other")
|
||
{
|
||
BLL.ConstService.InitConstValueProjectStatus(this.drpJobStatus, BLL.Const.ProjectPlanner_JobStatus, "2", true);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 下拉框选择事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnSearch_Click(object sender, EventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
|
||
protected void btnFind_Click(object sender, EventArgs e)
|
||
{
|
||
string eProjectId = this.Grid1.SelectedRowID;
|
||
BindGrid2(eProjectId);
|
||
}
|
||
|
||
protected void btnFind3_Click(object sender, EventArgs e)
|
||
{
|
||
string eProjectId = this.Grid1.SelectedRowID;
|
||
BindGrid3(eProjectId);
|
||
}
|
||
#endregion
|
||
|
||
#region 关闭弹出窗口
|
||
/// <summary>
|
||
/// 关闭窗口
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Window1_Close(object sender, EventArgs e)
|
||
{
|
||
string eprojectId = Grid1.SelectedRowID;
|
||
if (!string.IsNullOrEmpty(eprojectId))
|
||
{
|
||
BindGrid2(eprojectId);
|
||
}
|
||
}
|
||
|
||
protected void Window2_Close(object sender, EventArgs e)
|
||
{
|
||
string eprojectId = Grid1.SelectedRowID;
|
||
if (!string.IsNullOrEmpty(eprojectId))
|
||
{
|
||
BindGrid2(eprojectId);
|
||
}
|
||
}
|
||
|
||
protected void Window3_Close(object sender, EventArgs e)
|
||
{
|
||
string eprojectId = Grid1.SelectedRowID;
|
||
if (!string.IsNullOrEmpty(eprojectId))
|
||
{
|
||
BindGrid2(eprojectId);
|
||
}
|
||
|
||
string designInputId = this.hdDesignInputId.Text;
|
||
if (!string.IsNullOrEmpty(designInputId))
|
||
{
|
||
BindGrid3(designInputId);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 编辑矩阵
|
||
/// <summary>
|
||
/// 编辑
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnMatrix_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("请选择项目!");
|
||
return;
|
||
}
|
||
string Id = Grid1.SelectedRowID;
|
||
var eproject = BLL.EProjectService.GeteProjectById(Id);
|
||
if (eproject.PM_General_CDI == "CTE")
|
||
{
|
||
// 只能由PM或EM操作
|
||
if (eproject != null && (CurrUser.UserId == eproject.ProjectControl_ProjectManagerId || CurrUser.UserId == eproject.ProjectControl_EMManagerId))
|
||
{
|
||
Window1.Title = "Design Input Matrix (Job No. " + eproject.ProjectControl_JobNo + ")";
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DesignInputMatrix.aspx?eProjectId={0}", Id, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInParent("只能由所选项目的PM或EM操作!");
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInParent("专业互提条件输入只适用于CTE设计的项目,不适用于CDI外委项目!");
|
||
return;
|
||
}
|
||
}
|
||
|
||
protected void btnOther_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("请选择项目!");
|
||
return;
|
||
}
|
||
string Id = Grid1.SelectedRowID;
|
||
var eproject = BLL.EProjectService.GeteProjectById(Id);
|
||
if (eproject.PM_General_CDI == "CTE")
|
||
{
|
||
// 只能由PM或EM操作
|
||
if (eproject != null && (CurrUser.UserId == eproject.ProjectControl_ProjectManagerId || CurrUser.UserId == eproject.ProjectControl_EMManagerId))
|
||
{
|
||
Window2.Title = "Other Design Input (Job No. " + eproject.ProjectControl_JobNo + ")";
|
||
PageContext.RegisterStartupScript(Window6.GetShowReference(String.Format("OtherDesignInput.aspx?eProjectId={0}", Id, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInParent("只能由所选项目的PM或EM操作!");
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInParent("专业互提条件输入只适用于CTE设计的项目,不适用于CDI外委项目!");
|
||
return;
|
||
}
|
||
}
|
||
|
||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||
{
|
||
btnMatrix_Click(null, null);
|
||
}
|
||
#endregion
|
||
|
||
#region 点击Grid1加载Grid2
|
||
/// <summary>
|
||
/// Grid1行选择事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_RowSelect(object sender, GridRowSelectEventArgs e)
|
||
{
|
||
string eProjectId = this.Grid1.SelectedRowID;
|
||
BindGrid2(eProjectId);
|
||
BindGrid3(eProjectId);
|
||
}
|
||
private void BindGrid2(string eprojectId)
|
||
{
|
||
string strSql = @"SELECT input.DesignInputId,input.DesignRectId,(input.DesignInputChName+'<br/> '+input.DesignInputEnName) AS DesignInputName,
|
||
input.DesignInputNo,input.IssuedDiscipline,input.IssuedDisciplineCode,input.ReceivedDiscipline,
|
||
i.UserName AS IssuedMan,r.UserName AS ReceivedMan,input.PlanStartDate,input.PlanEndDate,input.ActStartDate,
|
||
input.ActEndDate,input.IsComplete
|
||
FROM dbo.Design_Input input
|
||
LEFT JOIN dbo.Sys_User i ON i.UserId = input.IssuedMan
|
||
LEFT JOIN dbo.Sys_User r ON r.UserId = input.ReceivedMan
|
||
WHERE input.EProjectId=@EProjectId ";
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
listStr.Add(new SqlParameter("@EProjectId", eprojectId));
|
||
if (!string.IsNullOrEmpty(txtDesignInputName.Text))
|
||
{
|
||
strSql += " AND (input.DesignInputChName LIKE @designInputName OR input.DesignInputEnName LIKE @designInputName)";
|
||
listStr.Add(new SqlParameter("@designInputName", "%" + this.txtDesignInputName.Text.Trim() + "%"));
|
||
}
|
||
if (!string.IsNullOrEmpty(txtIssuedDiscipline.Text))
|
||
{
|
||
strSql += " AND input.IssuedDiscipline LIKE @IssuedDiscipline ";
|
||
listStr.Add(new SqlParameter("@IssuedDiscipline", "%" + this.txtIssuedDiscipline.Text.Trim() + "%"));
|
||
}
|
||
if (!string.IsNullOrEmpty(txtReceivedDiscipline.Text))
|
||
{
|
||
strSql += " AND input.ReceivedDiscipline LIKE @ReceivedDiscipline ";
|
||
listStr.Add(new SqlParameter("@ReceivedDiscipline", "%" + this.txtReceivedDiscipline.Text.Trim() + "%"));
|
||
}
|
||
strSql += " ORDER BY input.IssuedDisciplineCode";
|
||
SqlParameter[] parameter = listStr.ToArray();
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||
Grid2.RecordCount = dt.Rows.Count;
|
||
dt = GetFilteredTable(Grid2.FilteredData, dt);
|
||
Grid2.DataSource = dt;
|
||
Grid2.DataBind();
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 过滤表头
|
||
/// <summary>
|
||
/// 过滤表头
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid2_FilterChange(object sender, EventArgs e)
|
||
{
|
||
BindGrid2(this.Grid1.SelectedRowID);
|
||
}
|
||
|
||
protected void Grid3_FilterChange(object sender, EventArgs e)
|
||
{
|
||
BindGrid3(this.Grid1.SelectedRowID);
|
||
}
|
||
#endregion
|
||
|
||
#region 点击Grid2加载Grid3
|
||
/// <summary>
|
||
/// Grid1行选择事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
//protected void Grid2_RowSelect(object sender, GridRowSelectEventArgs e)
|
||
//{
|
||
// string designInputId = this.Grid2.SelectedRowID;
|
||
// BindGrid3(designInputId);
|
||
//}
|
||
private void BindGrid3(string eprojectId)
|
||
{
|
||
string strSql = @"SELECT notice.DesignNoticeId, notice.DesignStage,notice.MutualIssuedNo,notice.MutualIssuedName,notice.MutualIssuedDef,
|
||
notice.PlanMutualIssuedDate,notice.ActMutualIssuedDate,input.IssuedDiscipline,input.ReceivedDiscipline,
|
||
input.DesignInputNo,input.ActStartDate,input.ActEndDate,
|
||
(CASE WHEN notice.IsNeedConfirm=1 THEN 'Yes' ELSE 'No' END) AS IsNeedConfirm,
|
||
notice.ConfirmResult,i.UserName AS IssuedMan,r.UserName AS ReceivedMan,notice.ReceivedManDef
|
||
FROM dbo.Design_Notice notice
|
||
LEFT JOIN dbo.Design_Input input ON input.DesignInputId = notice.DesignInputId
|
||
LEFT JOIN dbo.Sys_User i ON i.UserId = notice.IssuedMan
|
||
LEFT JOIN dbo.Sys_User r ON r.UserId = notice.ReceivedMan
|
||
WHERE input.EProjectId=@EProjectId";
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
listStr.Add(new SqlParameter("@EProjectId", eprojectId));
|
||
|
||
if (!string.IsNullOrEmpty(txtDesignInputName3.Text))
|
||
{
|
||
strSql += " AND notice.MutualIssuedName LIKE @designInputName ";
|
||
listStr.Add(new SqlParameter("@designInputName", "%" + this.txtDesignInputName3.Text.Trim() + "%"));
|
||
}
|
||
if (!string.IsNullOrEmpty(txtIssuedDiscipline3.Text))
|
||
{
|
||
strSql += " AND input.IssuedDiscipline LIKE @IssuedDiscipline ";
|
||
listStr.Add(new SqlParameter("@IssuedDiscipline", "%" + this.txtIssuedDiscipline3.Text.Trim() + "%"));
|
||
}
|
||
if (!string.IsNullOrEmpty(txtReceivedDiscipline3.Text))
|
||
{
|
||
strSql += " AND input.ReceivedDiscipline LIKE @ReceivedDiscipline ";
|
||
listStr.Add(new SqlParameter("@ReceivedDiscipline", "%" + this.txtReceivedDiscipline3.Text.Trim() + "%"));
|
||
}
|
||
|
||
SqlParameter[] parameter = listStr.ToArray();
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||
Grid3.RecordCount = dt.Rows.Count;
|
||
dt = GetFilteredTable(Grid3.FilteredData, dt);
|
||
Grid3.DataSource = dt;
|
||
Grid3.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region 录入设计输入计划
|
||
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
||
{
|
||
string eprojectId = Grid1.SelectedRowID;
|
||
var eproject = BLL.EProjectService.GeteProjectById(eprojectId);
|
||
|
||
// 只能由PM或EM操作
|
||
if (eproject != null && (CurrUser.UserId == eproject.ProjectControl_ProjectManagerId || CurrUser.UserId == eproject.ProjectControl_EMManagerId))
|
||
{
|
||
if (Grid2.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("请选择设计输入!");
|
||
return;
|
||
}
|
||
string Id = Grid2.SelectedRowID;
|
||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("DesignInputPlan.aspx?designInputId={0}", Id, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInParent("只能由该项目的PM或EM操作!");
|
||
return;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 设计输入计划完成(暂不用)
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnCompletePlan_Click(object sender, EventArgs e)
|
||
{
|
||
string eProjectId = this.Grid1.SelectedRowID;
|
||
if (!string.IsNullOrEmpty(eProjectId))
|
||
{
|
||
var eproject = BLL.EProjectService.GeteProjectById(eProjectId);
|
||
if (eproject != null && (CurrUser.UserId == eproject.ProjectControl_ProjectManagerId || CurrUser.UserId == eproject.ProjectControl_EMManagerId))
|
||
{
|
||
if (eproject.DesignPlanIsComplete == true)
|
||
{
|
||
ShowNotify("The design input plan has been completed ,Cannot be repeated!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
bool isComplete = true;
|
||
var inputList = BLL.DesignInputService.GetDesignInputByProject(eProjectId);
|
||
foreach (var q in inputList)
|
||
{
|
||
if (q.IssuedMan == null || q.ReceivedMan == null || !q.PlanStartDate.HasValue || !q.PlanStartDate.HasValue)
|
||
{
|
||
isComplete = false;
|
||
break;
|
||
}
|
||
}
|
||
if (isComplete)
|
||
{
|
||
BLL.DesignInputService.DesignInputPlanComplete(eProjectId, true);
|
||
// 邮件
|
||
PageBase bg = new PageBase();
|
||
foreach (var q in inputList)
|
||
{
|
||
string En_PlanEndDate = string.Empty;
|
||
string Ch_PlanEndDate = string.Empty;
|
||
if (q.PlanEndDate.HasValue)
|
||
{
|
||
Ch_PlanEndDate = string.Format("{0:M}", q.PlanEndDate);
|
||
System.Globalization.CultureInfo cult = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
|
||
string dd = q.PlanEndDate.Value.ToString("dd", cult) + "th";
|
||
string mm = q.PlanEndDate.Value.ToString("MMMM", cult);
|
||
En_PlanEndDate = dd + " of " + mm;
|
||
}
|
||
|
||
NameValueCollection nameValue = new NameValueCollection();
|
||
nameValue.Add("IssuedDiscOrNo", q.IssuedDiscipline);
|
||
nameValue.Add("En_PlanEndDate", En_PlanEndDate);
|
||
nameValue.Add("Ch_PlanEndDate", Ch_PlanEndDate);
|
||
//nameValue.Add("PlanEndDate", q.PlanEndDate.HasValue ? q.PlanEndDate.Value.Date.ToString("d") : "");
|
||
if (!string.IsNullOrEmpty(q.IssuedMan))
|
||
{
|
||
Model.Sys_User sys_User = new Model.Sys_User();
|
||
sys_User = BLL.Sys_UserService.GetUsersByUserId(q.IssuedMan);
|
||
nameValue.Add("UserName", sys_User.UserName);
|
||
List<Model.Sys_User> list = new List<Model.Sys_User>();
|
||
|
||
list.Add(sys_User);
|
||
bg.EmailSendMessage(BLL.Const.DesignInputString, nameValue, BLL.Const.NoCustomString, list, "");
|
||
}
|
||
}
|
||
ShowNotify("Design Input Plan Completed!", MessageBoxIcon.Success);
|
||
BindGrid();
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("Design Input Plan has unfinished items!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInParent("No permission, please let PM or ME operate!");
|
||
return;
|
||
}
|
||
}
|
||
|
||
else
|
||
{
|
||
ShowNotify("Please select project!", MessageBoxIcon.Warning);
|
||
}
|
||
|
||
}
|
||
|
||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid2.SelectedRowIndexArray.Length > 0)
|
||
{
|
||
foreach (int rowIndex in Grid2.SelectedRowIndexArray)
|
||
{
|
||
string rowID = Grid2.DataKeys[rowIndex][0].ToString();
|
||
var input = BLL.DesignInputService.GetDesignInputById(rowID);
|
||
string eprojectId = input.EProjectId;
|
||
var eproject = BLL.EProjectService.GeteProjectById(eprojectId);
|
||
if (eproject != null && (CurrUser.UserId == eproject.ProjectControl_ProjectManagerId || CurrUser.UserId == eproject.ProjectControl_EMManagerId))
|
||
{
|
||
if (judgementDelete(eprojectId))
|
||
{
|
||
BLL.DesignInputService.DeleteDesignInputById(rowID);
|
||
ShowNotify("该记录已删除!", MessageBoxIcon.Success);
|
||
BindGrid2(eprojectId);
|
||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Delete Design Input Plan");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInParent("只能由该项目的PM或EM操作!");
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请选择要删除的记录!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
|
||
protected void btnMenuDeleteNotice_Click(object sender, EventArgs e)
|
||
{
|
||
string noticeId = Grid3.SelectedRowID;
|
||
if (!string.IsNullOrEmpty(noticeId))
|
||
{
|
||
var notice = BLL.DesignInputService.GetDesignNotice(noticeId);
|
||
string designInputId = notice.DesignInputId;
|
||
var input = BLL.DesignInputService.GetDesignInputById(designInputId);
|
||
|
||
var del = from x in Funs.DB.Design_Notice where x.Sup_DesignNoticeId == noticeId select x;
|
||
if (del.Count() == 0)
|
||
{
|
||
if (CurrUser.UserId == input.IssuedMan)
|
||
{
|
||
DesignInputService.DeleteDesignNoticeById(noticeId);
|
||
ShowNotify("该通知单已删除!", MessageBoxIcon.Success);
|
||
BindGrid3(designInputId);
|
||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Delete Design Notice");
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("只能由提出人删除!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("有变更通知单了,不能删除!");
|
||
}
|
||
}
|
||
}
|
||
|
||
#region 判断是否可删除
|
||
|
||
/// <summary>
|
||
/// 判断是否可以删除
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private bool judgementDelete(string eProjectId)
|
||
{
|
||
if (CurrUser.Account == Const.Gly)
|
||
{
|
||
return true;
|
||
}
|
||
else
|
||
{
|
||
string content = "";
|
||
|
||
var eproject = (from x in Funs.DB.Editor_EProject where x.EProjectId == eProjectId && x.DesignPlanIsComplete == true select x).ToList();
|
||
if (eproject.Count > 0)
|
||
{
|
||
content = "设计输入策划已完成,不能删除!";
|
||
}
|
||
if (content == "")
|
||
{
|
||
return true;
|
||
}
|
||
else
|
||
{
|
||
ShowNotify(content);
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
|
||
/// <summary>
|
||
/// 创建互提通知单
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnCreateIssuedNotice_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid2.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("请选择设计输入记录!");
|
||
return;
|
||
}
|
||
string Id = Grid2.SelectedRowID;
|
||
var notice = BLL.DesignInputService.GetDesignNoticeById(Id);
|
||
var input = BLL.DesignInputService.GetDesignInputById(Id);
|
||
if (!string.IsNullOrEmpty(input.IssuedMan) && !string.IsNullOrEmpty(input.ReceivedMan) && input.PlanStartDate.HasValue && input.PlanEndDate.HasValue)
|
||
{
|
||
if (input.IssuedMan == CurrUser.UserId)
|
||
{
|
||
if (notice == null)
|
||
{
|
||
string window = String.Format("IssuedNotice.aspx?designInputId={0}&flag=add", Id, "编辑 - ");
|
||
PageContext.RegisterStartupScript(Window3.GetSaveStateReference(this.hdDesignInputId.ClientID) + Window3.GetShowReference(window));
|
||
//PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("IssuedNotice.aspx?designInputId={0}&flag=add", Id, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("互提通知单已创建,可增补互提通知单!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("只能由提出人来创建!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("设计输入策划未完成,不能创建互提通知单!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 增补互提通知单
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnAddIssuedNotice_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid2.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("请选择设计输入记录!");
|
||
return;
|
||
}
|
||
string Id = Grid2.SelectedRowID;
|
||
var input = BLL.DesignInputService.GetDesignInputById(Id);
|
||
var notice = BLL.DesignInputService.GetDesignNoticeById(Id);
|
||
if (input.IssuedMan == CurrUser.UserId)
|
||
{
|
||
if (notice != null)
|
||
{
|
||
string window = String.Format("IssuedNotice.aspx?designInputId={0}&flag=sup", Id, "编辑 - ");
|
||
PageContext.RegisterStartupScript(Window3.GetSaveStateReference(this.hdDesignInputId.ClientID) + Window3.GetShowReference(window));
|
||
//PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("IssuedNotice.aspx?designInputId={0}&flag=sup", Id, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请先创建互提通知单!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("当前用户不是提出人,不能创建!", MessageBoxIcon.Warning);
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 编辑提出通知单
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnMenuEditNotice_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid3.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("请选择通知单!");
|
||
return;
|
||
}
|
||
string Id = Grid3.SelectedRowID;
|
||
if (!string.IsNullOrEmpty(Id))
|
||
{
|
||
var flow = BLL.DesignInputService.GetNoticeFlow(Id);
|
||
if (flow != null)
|
||
{
|
||
if (flow.SubmitMan == CurrUser.UserId)
|
||
{
|
||
string window = String.Format("IssuedNotice.aspx?designNoticeId={0}&flag=edit", Id, "编辑 - ");
|
||
PageContext.RegisterStartupScript(Window3.GetSaveStateReference(this.hdDesignInputId.ClientID) + Window3.GetShowReference(window));
|
||
//PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("IssuedNotice.aspx?designNoticeId={0}&flag=edit", Id, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("当前用户不是办理人!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("该通知单办理流程已结束!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请选择互提通知单!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 变更提出通知单
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnMenuChange_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid3.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("请选择通知单!");
|
||
return;
|
||
}
|
||
string Id = Grid3.SelectedRowID;
|
||
if (!string.IsNullOrEmpty(Id))
|
||
{
|
||
var notice = BLL.DesignInputService.GetDesignNotice(Id);
|
||
var input = BLL.DesignInputService.GetDesignInputById(notice.DesignInputId);
|
||
if (input.IssuedMan == CurrUser.UserId)
|
||
{
|
||
if (notice.Flag == "1")
|
||
{
|
||
string window = String.Format("IssuedNotice.aspx?designNoticeId={0}&flag=change", Id, "编辑 - ");
|
||
PageContext.RegisterStartupScript(Window3.GetSaveStateReference(this.hdDesignInputId.ClientID) + Window3.GetShowReference(window));
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInParent("请选择互提通知单(非变更通知单)!");
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("当前用户不是提出人,不能操作!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请选择互提通知单!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 通知单流程
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnNoticeFlow_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid3.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("请选择通知单!");
|
||
return;
|
||
}
|
||
string Id = Grid3.SelectedRowID;
|
||
if (!string.IsNullOrEmpty(Id))
|
||
{
|
||
string window = String.Format("IssuedNoticeFlow.aspx?designNoticeId={0}", Id, "编辑 - ");
|
||
PageContext.RegisterStartupScript(Window4.GetSaveStateReference(this.hdDesignInputId.ClientID) + Window4.GetShowReference(window));
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("请选择通知单!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
|
||
|
||
// 过程确认完成(暂不用)
|
||
protected void btnComplete_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid2.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("Please select at least one record!");
|
||
return;
|
||
}
|
||
string Id = Grid2.SelectedRowID;
|
||
var input = BLL.DesignInputService.GetDesignInputById(Id);
|
||
var eproject = BLL.EProjectService.GeteProjectById(input.EProjectId);
|
||
var notice = BLL.DesignInputService.GetDesignNoticeById(Id);
|
||
if (CurrUser.UserId == input.ReceivedMan || CurrUser.UserId == eproject.ProjectControl_EMManagerId || CurrUser.UserId == eproject.ProjectControl_ProjectManagerId)
|
||
{
|
||
if (notice != null)
|
||
{
|
||
BLL.DesignInputService.UpdateDesignInputComplete(Id, true, DateTime.Now);
|
||
ShowNotify("Design Input Process Completed!", MessageBoxIcon.Success);
|
||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Design Input Process Completed");
|
||
BindGrid2(Grid1.SelectedRowID);
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInParent("Issued Notice Not Created!");
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInParent("No permission, please let received person or PM or ME operate!");
|
||
return;
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 提交归档,暂不用
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnSubmitForFiling_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("Please select one record!");
|
||
return;
|
||
}
|
||
string Id = Grid1.SelectedRowID;
|
||
if (!string.IsNullOrEmpty(Id))
|
||
{
|
||
var input = from x in Funs.DB.Design_Input where x.EProjectId == Id select x;
|
||
var complitedInput= from x in Funs.DB.Design_Input where x.EProjectId == Id && x.IsComplete==true select x;
|
||
// 说明有通知单,并且所有通知单已完成
|
||
if (input.Count() > 0 && input.Count() == complitedInput.Count())
|
||
{
|
||
BLL.DesignInputService.UpdateProjectFiling(Id, true);
|
||
ShowNotify("Design input has been submitted for filing!", MessageBoxIcon.Success);
|
||
BindGrid();
|
||
|
||
// 邮件 todo
|
||
//var eproject = BLL.EProjectService.GeteProjectById(Id);
|
||
//NameValueCollection nameValue = new NameValueCollection();
|
||
//nameValue.Add("IssuedDiscOrNo", "项目:"+ eproject.ProjectControl_JobNo);
|
||
////nameValue.Add("PlanEndDate", q.PlanEndDate.HasValue ? q.PlanEndDate.Value.Date.ToString("d") : "");
|
||
//var user = from x in Funs.DB.ManHours_Plan
|
||
// join y in Funs.DB.Sys_User on x.EngineerId equals y.UserId
|
||
// where x.EProjectId == Id && y.RoleId == Const.Role_TDC
|
||
// select x;
|
||
//if (user.Count()>0)
|
||
//{
|
||
// Model.Sys_User sys_User = new Model.Sys_User();
|
||
// sys_User = BLL.Sys_UserService.GetUsersByUserId(q.IssuedMan);
|
||
// //nameValue.Add("IssuedMan", sys_User.UserName);
|
||
// List<Model.Sys_User> list = new List<Model.Sys_User>();
|
||
|
||
// list.Add(sys_User);
|
||
// EmailSendMessage(BLL.Const.DesignInputString, nameValue, BLL.Const.NoCustomString, list, "");
|
||
//}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("Issued notice Process not completed,Cannot submit for filing!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("Please select at record!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 文档确认,暂不用
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnDocumentConfirm_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("Please select one record!");
|
||
return;
|
||
}
|
||
string Id = Grid1.SelectedRowID;
|
||
if (!string.IsNullOrEmpty(Id))
|
||
{
|
||
var input = from x in Funs.DB.Editor_EProject where x.EProjectId == Id select x;
|
||
|
||
// 说明项目设计已提交归档了,可进行文档确认
|
||
if (input.Count() > 0 && input.First().DesignInputIsFile == true)
|
||
{
|
||
BLL.DesignInputService.UpdateDesignDocumentIsConfirm(Id, true);
|
||
ShowNotify("Design input document confirmed!", MessageBoxIcon.Success);
|
||
BindGrid();
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("Please submit the document for archiving before confirmation!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("Please select at record!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 文档回退,暂不用
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnDocumentFallback_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("Please select at least one record!");
|
||
return;
|
||
}
|
||
string Id = Grid1.SelectedRowID;
|
||
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("DocumentFallback.aspx?eprojectId={0}", Id, "编辑 - ")));
|
||
}
|
||
}
|
||
} |