20240125本部检查调整

This commit is contained in:
2024-01-25 17:24:20 +08:00
parent 6b5fb3a865
commit 2449c9fa32
14 changed files with 381 additions and 176 deletions
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.HSSE.Check
{
@@ -21,22 +22,16 @@ namespace FineUIPro.Web.HSSE.Check
/// </summary>
public void BindGrid()
{
string strSql = @"SELECT Item.RectifyItemId,
Item.RectifyId,
Item.WrongContent,
Item.Requirement,
Item.LimitTime,
Item.RectifyResults,
Item.IsRectify,
Rectify.States,
Rectify.ProjectId "
+ @" FROM ProjectSupervision_RectifyItem AS Item "
+ @" LEFT JOIN ProjectSupervision_Rectify AS Rectify ON Rectify.RectifyId=Item.RectifyId";
string strSql = @"SELECT (CASE WHEN Rectify.States=1 THEN '待整改' WHEN Rectify.States=2 THEN '待确认' WHEN Rectify.States=3 THEN '已完成' ELSE '待签发' END) AS StatesName,
Rectify.RectifyCode,Item.RectifyItemId,Item.RectifyId,Item.WrongContent,Item.Requirement,Item.LimitTime,Item.RectifyResults,Item.IsRectify,Rectify.States,Rectify.ProjectId
FROM ProjectSupervision_RectifyItem AS Item
LEFT JOIN ProjectSupervision_Rectify AS Rectify ON Rectify.RectifyId=Item.RectifyId
WHERE Rectify.States !='0' AND Rectify.States IS NOT NULL ";
List<SqlParameter> listStr = new List<SqlParameter>();
strSql += " WHERE Rectify.ProjectId = @ProjectId";
strSql += " AND Rectify.States = @States";
strSql += " AND Rectify.ProjectId = @ProjectId";
strSql += " AND Item.IsRectify = @IsRectify";
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
listStr.Add(new SqlParameter("@States", this.rbStates.SelectedValue));
listStr.Add(new SqlParameter("@IsRectify", this.rbStates.SelectedValue));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
var table = this.GetPagedDataTable(Grid1, tb);
@@ -52,6 +47,14 @@ namespace FineUIPro.Web.HSSE.Check
protected void rbStates_SelectedIndexChanged(object sender, EventArgs e)
{
BindGrid();
if (this.rbStates.SelectedValue == "1")
{
this.btnSubmit.Hidden = true;
}
else
{
this.btnSubmit.Hidden = false;
}
}
/// <summary>
@@ -95,5 +98,34 @@ namespace FineUIPro.Web.HSSE.Check
}
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString().Split(',')[0];
var getV = Funs.DB.ProjectSupervision_RectifyItem.FirstOrDefault(x => x.RectifyItemId == rowID);
if (getV != null)
{
var getR = Funs.DB.ProjectSupervision_Rectify.FirstOrDefault(x => x.RectifyId == getV.RectifyId);
if (getR != null && getR.States != Const.State_3)
{
getR.States = BLL.Const.State_2;
Funs.DB.SubmitChanges();
}
}
}
BindGrid();
ShowNotify("数据已提交成功!");
}
}
}
}