This commit is contained in:
2025-10-09 10:39:49 +08:00
parent 6b422a4781
commit aea0bf3079
8 changed files with 181 additions and 67 deletions
@@ -1183,7 +1183,7 @@ namespace FineUIPro.Web.ContractorQuality
pun.UserDepStartDate = DateTime.Now;//用户部门审批到达时间
pun.Pause = false;//如果审核通过,取消暂停
#region :
#region :
Model.EmailPop pops = Funs.DB.EmailPop.FirstOrDefault(x => x.EmailID == BLL.Const.EmailPopId);
if (pops == null)
{
@@ -1196,31 +1196,56 @@ namespace FineUIPro.Web.ContractorQuality
var emailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("主协调员填写完成后审批通过通知"));
if (emailTemplate.Count() > 0)
{
string departLeader = string.Empty;
string delegatedRepresentative = string.Empty;//部门代理人
string departmentLeader = string.Empty;//部门经理
var depart = BLL.DepartService.GetDepartById(drpUserDep.SelectedValue);
if (depart != null)
{
departLeader = depart.DepartLeader;
delegatedRepresentative = depart.DelegatedRepresentative;
departmentLeader = depart.DepartLeader;
}
if (!string.IsNullOrEmpty(departLeader))
if (!string.IsNullOrEmpty(delegatedRepresentative))
{
var userTo = from x in Funs.DB.Sys_User
where x.UserId.Contains(departLeader) && x.Email != null && x.Email != ""
where x.UserId.Contains(delegatedRepresentative) && x.Email != null && x.Email != ""
select x;
if (userTo != null)
{
mailTo = userTo.Select(x => x.Email).ToArray();
}
}
var userCc = from x in Funs.DB.View_EMail_UserTo
where ((x.PunishmentId == this.PunishmentId && x.AuditDate != null) || x.UserId.Contains(pun.Violation_Inspector))
&& x.Email != null && x.Email != ""
select x;
if (userCc != null)
{
mailCC = userCc.Select(x => x.Email).Distinct().ToArray();
var userCc = from x in Funs.DB.View_EMail_UserTo
where ((x.PunishmentId == this.PunishmentId && x.AuditDate != null) || x.UserId.Contains(pun.Violation_Inspector) || x.UserId.Contains(departmentLeader))
&& x.Email != null && x.Email != ""
select x;
if (userCc != null)
{
mailCC = userCc.Select(x => x.Email).Distinct().ToArray();
}
}
else
{
if(!string.IsNullOrEmpty(departmentLeader))
{
var userTo = from x in Funs.DB.Sys_User
where x.UserId.Contains(departmentLeader) && x.Email != null && x.Email != ""
select x;
if (userTo != null)
{
mailTo = userTo.Select(x => x.Email).ToArray();
}
}
var userCc = from x in Funs.DB.View_EMail_UserTo
where ((x.PunishmentId == this.PunishmentId && x.AuditDate != null) || x.UserId.Contains(pun.Violation_Inspector))
&& x.Email != null && x.Email != ""
select x;
if (userCc != null)
{
mailCC = userCc.Select(x => x.Email).Distinct().ToArray();
}
}
if (mailTo.Length > 0)
{
NameValueCollection myPram = new NameValueCollection();