This commit is contained in:
2024-09-18 10:36:26 +08:00
parent 1ec4f71825
commit cba8e9e2f7
36 changed files with 4132 additions and 476 deletions
+238 -16
View File
@@ -9,6 +9,7 @@ using System.IO;
using System.Linq;
using System.Text;
using AspNet = System.Web.UI.WebControls;
using System.Web.UI.DataVisualization.Charting;
namespace FineUIPro.Web.SES
{
@@ -42,7 +43,7 @@ namespace FineUIPro.Web.SES
private void BindGrid()
{
string strSql = @"SELECT * FROM dbo.View_EMC_Punishment WHERE Flag='2' ";
string strSql = @"SELECT * FROM dbo.View_EMC_Que_Punishment WHERE Flag='2' ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(this.txtFO_NO.Text.Trim()))
@@ -50,7 +51,7 @@ namespace FineUIPro.Web.SES
strSql += " AND FO_NO LIKE @FO_NO";
listStr.Add(new SqlParameter("@FO_NO", "%" + this.txtFO_NO.Text.Trim() + "%"));
}
if (drpContractAdmin.SelectedValue != Const._Null)
if (drpContractAdmin.SelectedValue != Const._Null && drpContractAdmin.SelectedValue != null)
{
strSql += " AND Contract_AdminId = @Contract_AdminId";
listStr.Add(new SqlParameter("@Contract_AdminId", drpContractAdmin.SelectedValue));
@@ -73,6 +74,17 @@ namespace FineUIPro.Web.SES
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
for (int i = 0; i < Grid1.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(Grid1.Rows[i].FindControl("lbtnUrl")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
#region
@@ -88,8 +100,157 @@ namespace FineUIPro.Web.SES
Alert.ShowInParent("Please select at least one record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CQualityPunishEdit.aspx?punishmentId={0}", Id, "编辑 - ")));
string rowID = Grid1.SelectedRowID;
var pun = BLL.PunishmentService.GetPunishmentById(rowID);
if (pun != null)
{
if (pun.IsAudit == true)
{
if (CurrUser.UserId == pun.AuditMan)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CQualityPunishEdit.aspx?punishmentId={0}", rowID, "编辑 - ")));
}
else
{
ShowNotify("已批准!只有批准人有修改权限!", MessageBoxIcon.Warning);
}
}
else
{
if (pun.IsFrame == true)
{
var datas = BLL.SESRelatedDataService.GetSESRelatedDataByFoNo(pun.FO_NO);
if (CurrUser.UserId == datas.Main_Coordinator || CurrUser.UserId == pun.Violation_Inspector || CurrUser.UserId == Const.GlyId)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CQualityPunishEdit.aspx?punishmentId={0}", rowID, "编辑 - ")));
}
else
{
ShowNotify("只有主协调员,发起人(违章检查人)有修改权限!", MessageBoxIcon.Warning);
}
}
else
{
if (CurrUser.UserId == pun.Requisitioner || CurrUser.UserId == pun.Violation_Inspector || CurrUser.UserId == Const.GlyId)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CQualityPunishEdit.aspx?punishmentId={0}", rowID, "编辑 - ")));
}
else
{
ShowNotify("只有合同请购人,发起人(违章检查人)有修改权限!", MessageBoxIcon.Warning);
}
}
}
}
}
protected void btnAudit_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string rowID = Grid1.SelectedRowID;
var pun = BLL.PunishmentService.GetPunishmentById(rowID);
string auditMan=string.Empty;
if (pun != null)
{
if (pun.IsFrame == true)
{
var fc = BLL.SESRelatedDataService.GetSESRelatedDataByFoNo(pun.FO_NO);
string curUser = this.CurrUser.UserId; // 当前用户
string violationInspector = pun.Violation_Inspector; // 发起人
string leader = string.Empty; // 主协调员部门领导
string mainCoordinator = fc.Main_Coordinator;
var userInfo = BLL.Sys_UserService.GetUsersByUserId(fc.Main_Coordinator);
if (userInfo != null)
{
var dep = BLL.DepartService.GetDepartById(userInfo.DepartId);
if (dep != null)
{
leader = dep.DepartLeader;
}
}
// 当前用户不是主调协员
if (curUser != mainCoordinator)
{
// 当前用户是主调协员部门领导 不发邮件
if (curUser == leader)
{
auditMan = leader;
}
else if(curUser==Const.GlyId)
{
auditMan = Const.GlyId;
}
else
{
ShowNotify("您没有审核权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
else // 当前用户是主调协员
{
auditMan = mainCoordinator;
// 发邮件给主调协员部门领导
}
}
// 非框架合同
else
{
string curUser = this.CurrUser.UserId; // 当前用户
string violationInspector = pun.Violation_Inspector; // 发起人
string leader = string.Empty; // 请购人部门领导
string requisitioner = pun.Requisitioner; // 请购人
var userInfo = BLL.Sys_UserService.GetUsersByUserId(pun.Requisitioner);
if (userInfo != null)
{
var dep = BLL.DepartService.GetDepartById(userInfo.DepartId);
if (dep != null)
{
leader = dep.DepartLeader;
}
}
// 当前用户不是请购人
if (curUser != requisitioner)
{
// 当前用户是请购人部门领导 不发邮件
if (curUser == leader)
{
auditMan = leader;
}
else if (curUser == Const.GlyId)
{
auditMan = Const.GlyId;
}
else
{
ShowNotify("您没有审核权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
else // 当前用户是请购人
{
auditMan = requisitioner;
// 发邮件给请购人部门领导
}
}
if (auditMan != string.Empty)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CQualityPunishEdit.aspx?punishmentId={0}&auditMan={1}&audit=audit", rowID, auditMan, "编辑 - ")));
}
else
{
ShowNotify("您没有审核权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
}
@@ -140,20 +301,85 @@ namespace FineUIPro.Web.SES
/// </summary>
private void DeleteData()
{
if (Grid1.SelectedRowIndexArray.Length > 0)
if (!string.IsNullOrEmpty(Grid1.SelectedRowID))
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
string rowID = Grid1.SelectedRowID;
var pun = BLL.PunishmentService.GetPunishmentById(rowID);
if (pun != null)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var pun = BLL.PunishmentService.GetPunishmentById(rowID);
if (pun != null)
if (pun.IsFrame == true)
{
if (judgementDelete(rowID, false))
var datas = BLL.SESRelatedDataService.GetSESRelatedDataByFoNo(pun.FO_NO);
if (pun.IsAudit == true) // 审核后只有批准人可删除
{
BLL.PunishmentService.DeletePunishmentById(rowID);
if (CurrUser.UserId == pun.AuditMan)
{
if (judgementDelete(rowID, false))
{
BLL.PunishmentService.DeletePunishmentById(rowID);
}
}
else
{
ShowNotify("已批准!只有批准人有删除权限!", MessageBoxIcon.Warning);
return;
}
}
else
{
if (CurrUser.UserId == datas.Main_Coordinator || CurrUser.UserId == pun.Violation_Inspector || CurrUser.UserId == Const.GlyId)
{
if (judgementDelete(rowID, false))
{
BLL.PunishmentService.DeletePunishmentById(rowID);
}
}
else
{
ShowNotify("只有主协调员,发起人(违章检查人)有删除权限!", MessageBoxIcon.Warning);
return;
}
}
}
else
{
if (pun.IsAudit == true)
{
if (CurrUser.UserId == pun.AuditMan)
{
if (judgementDelete(rowID, false))
{
BLL.PunishmentService.DeletePunishmentById(rowID);
}
}
else
{
ShowNotify("已批准!只有批准人有删除权限!", MessageBoxIcon.Warning);
return;
}
}
else
{
if (CurrUser.UserId == pun.Requisitioner || CurrUser.UserId == pun.Violation_Inspector || CurrUser.UserId == Const.GlyId)
{
if (judgementDelete(rowID, false))
{
BLL.PunishmentService.DeletePunishmentById(rowID);
}
}
else
{
ShowNotify("只有合同请购人,发起人(违章检查人)有删除权限!", MessageBoxIcon.Warning);
return;
}
}
}
}
BindGrid();
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Delete Contractor Safety Punishment");
ShowNotify("Deleted successfully!");
@@ -194,11 +420,7 @@ namespace FineUIPro.Web.SES
private bool judgementDelete(string id, bool isShow)
{
string content = string.Empty;
//if (Funs.DB.Sys_User.FirstOrDefault(x => x.RoleId == id) != null)
//{
// content = "This role is already in use in [user information] and cannot be deleted!";
//}
if (string.IsNullOrEmpty(content))
{
return true;