Basf_TCC7/HJGL/FineUIPro.Web/WeldingProcess/TrustManage/PointForAudit.aspx.cs

204 lines
7.7 KiB
C#
Raw Normal View History

2024-05-08 10:02:08 +08:00
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.WeldingProcess.TrustManage
{
public partial class PointForAudit : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
BLL.Base_DetectionTypeService.InitDetectionTypeDropDownList(drpNde, "", false, "");
drpNde.SelectedValue = "32617d42-24cb-4390-b115-d53c9c9e2c81"; // 默认RT
BindGrid();
}
}
private void BindGrid()
{
string strSql = @"SELECT PointBatchItemId,PointBatchId,PointBatchCode,WeldJointId,PointState,PointDate,WorkAreaCode,
WeldJointCode,JointArea,Size,WelderCode,WeldingDate,PipelineCode,PipingClassName,
(CASE WHEN IsWelderFirst=1 THEN '是' ELSE '否' END) AS IsWelderFirst,
JLAudit,GLGSAudit,QTAudit,IsPointAudit
FROM dbo.View_Batch_PointBatchItem
WHERE PointState IS NOT NULL";
List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(this.txtPointStartDate.Text))
{
strSql += " AND PointDate >= @PointStartDate";
listStr.Add(new SqlParameter("@PointStartDate", Convert.ToDateTime(this.txtPointStartDate.Text)));
}
if (!string.IsNullOrEmpty(this.txtPointEndDate.Text))
{
strSql += " AND PointDate < @PointEndDate";
listStr.Add(new SqlParameter("@PointEndDate", Convert.ToDateTime(this.txtPointEndDate.Text).AddDays(1)));
}
if (drpNoAudit.SelectedValue != "0")
{
if (drpNoAudit.SelectedValue == "1")
{
strSql += " AND JLAudit='未审核'";
}
if (drpNoAudit.SelectedValue == "2")
{
strSql += " AND GLGSAudit='未审核'";
}
if (drpNoAudit.SelectedValue == "3")
{
strSql += " AND QTAudit='未审核'";
}
}
else
{
strSql += " AND (JLAudit='未审核' OR GLGSAudit='未审核' OR QTAudit='未审核')";
}
if (drpNde.SelectedValue != null)
{
strSql += " AND DetectionTypeId=@DetectionTypeId";
listStr.Add(new SqlParameter("@DetectionTypeId", drpNde.SelectedValue));
}
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();
}
#region
/// <summary>
/// 改变索引事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
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)
{
this.BindGrid();
}
#endregion
protected void BtnAnalyse_Click(object sender, EventArgs e)
{
BindGrid();
}
protected void Window2_Close(object sender, WindowCloseEventArgs e)
{
this.BindGrid();
}
protected void btnJLAudit_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PointForAuditMenuId, Const.BtnJLAudit))
{
if (Grid1.SelectedRowIndexArray.Length <= 0)
{
Alert.ShowInTop("最少选中一行!", MessageBoxIcon.Warning);
return;
}
string userId = CurrUser.UserId;
foreach (string pointBatchItemId in Grid1.SelectedRowIDArray)
{
var pointBatchItem = BLL.Batch_PointBatchItemService.GetPointBatchItemByPointBatchItemId(pointBatchItemId);
pointBatchItem.JLAudit = userId;
BLL.Funs.DB.SubmitChanges();
}
Alert.ShowInTop("所选项审核完成!", MessageBoxIcon.Warning);
BindGrid();
}
else
{
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
return;
}
}
protected void btnGLGSAudit_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PointForAuditMenuId, Const.BtnGLGSAudit))
{
if (Grid1.SelectedRowIndexArray.Length <= 0)
{
Alert.ShowInTop("最少选中一行!", MessageBoxIcon.Warning);
return;
}
string userId = CurrUser.UserId;
foreach (string pointBatchItemId in Grid1.SelectedRowIDArray)
{
var pointBatchItem = BLL.Batch_PointBatchItemService.GetPointBatchItemByPointBatchItemId(pointBatchItemId);
pointBatchItem.GLGSAudit = userId;
BLL.Funs.DB.SubmitChanges();
}
Alert.ShowInTop("所选项审核完成!", MessageBoxIcon.Warning);
BindGrid();
}
else
{
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
return;
}
}
protected void btnOtherAudit_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PointForAuditMenuId, Const.BtnQTAudit))
{
if (Grid1.SelectedRowIndexArray.Length <= 0)
{
Alert.ShowInTop("最少选中一行!", MessageBoxIcon.Warning);
return;
}
string userId = CurrUser.UserId;
foreach (string pointBatchItemId in Grid1.SelectedRowIDArray)
{
var pointBatchItem = BLL.Batch_PointBatchItemService.GetPointBatchItemByPointBatchItemId(pointBatchItemId);
pointBatchItem.QTAudit = userId;
BLL.Funs.DB.SubmitChanges();
}
Alert.ShowInTop("所选项审核完成!", MessageBoxIcon.Warning);
BindGrid();
}
else
{
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
return;
}
}
}
}