79 lines
2.8 KiB
C#
79 lines
2.8 KiB
C#
using FineUIPro.Web.common;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BLL
|
|
{
|
|
public class TaskScheduleService
|
|
{
|
|
|
|
//NDE点口未审核统计
|
|
public static int NDEWeldPointNotAuditStatusTotal(int type)
|
|
{
|
|
if (type == 0)
|
|
return 0;
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append(@"SELECT count(1) FROM dbo.View_Batch_PointBatchItem WHERE PointState IS NOT NULL ");
|
|
switch (type)
|
|
{
|
|
case 1:
|
|
strSql.Append(" AND JLAudit='未审核'");
|
|
break;
|
|
case 2:
|
|
strSql.Append(" AND GLGSAudit='未审核' ");
|
|
break;
|
|
}
|
|
|
|
int totalCount= SQLHelper.getIntValue(strSql.ToString());
|
|
|
|
return totalCount;
|
|
}
|
|
|
|
public static void GetNDEAuditEmailTemplate(int type)
|
|
{
|
|
var pop = MailHelper.getEmailPop();
|
|
if (pop == null)
|
|
{
|
|
BLL.ErrLogInfo.WriteLog($"未配置邮件服务器");
|
|
return;
|
|
}
|
|
string templateContent = string.Empty;
|
|
List<string> emailSend = new List<string>(); //发送人
|
|
List<string> emailCC = new List<string>(); //抄送给
|
|
string mailSubject = string.Empty;
|
|
string typeStr = string.Empty;
|
|
if (type == 1)
|
|
typeStr = "监理";
|
|
if (type == 2)
|
|
typeStr = "管理公司";
|
|
|
|
var emailTemplate = BLL.Email_Send.Email_SendTemplateService.GetEmailNotifier(typeStr);
|
|
if (emailTemplate == null)
|
|
{
|
|
BLL.ErrLogInfo.WriteLog($"不存在此邮件模版");
|
|
return;
|
|
}
|
|
emailSend = BLL.Email_Send.Email_SendTemplateService.GetEmailByTemplateId(emailTemplate.EmailId, "0");
|
|
emailCC = BLL.Email_Send.Email_SendTemplateService.GetEmailByTemplateId(emailTemplate.EmailId, "1");
|
|
if (emailSend.Count == 0)
|
|
{
|
|
BLL.ErrLogInfo.WriteLog($"未检测到发送人邮箱,请先配置邮箱地址");
|
|
return;
|
|
}
|
|
mailSubject = $"{typeStr}—{emailTemplate.EailTiaoJian}"; //发送主题
|
|
templateContent = emailTemplate.EmailContext;
|
|
int totalCount = BLL.TaskScheduleService.NDEWeldPointNotAuditStatusTotal(type);
|
|
templateContent = templateContent.Replace("{{totalCount}}", totalCount.ToString());
|
|
|
|
string resultMessage = "";
|
|
MailHelper.SendNetMail(pop, pop.EmailYx, emailSend.ToArray(), mailSubject, templateContent, string.Empty, string.Empty, string.Empty, emailCC.ToArray(), out resultMessage);
|
|
|
|
}
|
|
}
|
|
}
|