20250729 新增合同绩效违规处理邮件
This commit is contained in:
parent
c10314d301
commit
50ddcb8dcf
|
@ -226,7 +226,7 @@ namespace BLL
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据承包商ID获取未关闭的FO
|
||||
/// 根据承包商ID获取未关闭的且有效的及过期一年合同
|
||||
/// </summary>
|
||||
/// <param name="dropName"></param>
|
||||
/// <param name="ContractorId"></param>
|
||||
|
@ -235,7 +235,12 @@ namespace BLL
|
|||
{
|
||||
dropName.DataValueField = "FO_NO";
|
||||
dropName.DataTextField = "FO_NO";
|
||||
dropName.DataSource = (from x in Funs.DB.FC_SESRelatedData where x.Contractor == ContractorId && x.FC_Status != "Closed" orderby x.FO_NO select x.FO_NO).Distinct();
|
||||
dropName.DataSource = (from x in Funs.DB.FC_SESRelatedData
|
||||
where x.Contractor == ContractorId
|
||||
&& x.FC_Status != "Closed"
|
||||
&& x.Expire_Date.Value.AddYears(1) >= DateTime.Now
|
||||
orderby x.FO_NO
|
||||
select x.FO_NO).Distinct();
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
|
|
|
@ -350,7 +350,7 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static List<Model.View_Sys_Users> GetUserViewList()
|
||||
{
|
||||
return (from x in Funs.DB.View_Sys_Users where x.IsPost == true orderby x.DepartName, x.UserName select x).ToList();
|
||||
return (from x in Funs.DB.View_Sys_Users orderby x.DepartName, x.UserName select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
using FineUIPro.Web.common;
|
||||
using Model;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class Global : System.Web.HttpApplication
|
||||
{
|
||||
|
@ -25,7 +26,7 @@
|
|||
|
||||
protected void Application_Start(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
Application["OnlineUserCount"] = 0;
|
||||
try
|
||||
{
|
||||
|
@ -55,7 +56,7 @@
|
|||
aTimer.Interval = 1000 * 60 * 60;
|
||||
aTimer.Enabled = true;
|
||||
aTimer.Start();
|
||||
|
||||
|
||||
}
|
||||
//自动填写评价
|
||||
if (DateTime.Now.Day == 12)
|
||||
|
@ -66,7 +67,7 @@
|
|||
aTimer.Interval = 1800000;
|
||||
aTimer.Enabled = true;
|
||||
aTimer.Start();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 过期提示
|
||||
|
@ -83,7 +84,7 @@
|
|||
aTimer.Interval = 1000 * 60 * 60;
|
||||
aTimer.Enabled = true;
|
||||
aTimer.Start();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 框架承包商评估表的填写邮件通知
|
||||
|
@ -104,7 +105,7 @@
|
|||
fcTimer.Elapsed += new System.Timers.ElapsedEventHandler(FC_AutoStatus);
|
||||
//120分钟执行一次
|
||||
fcTimer.Interval = 1000 * 60 * 60;
|
||||
fcTimer.Enabled = true;
|
||||
fcTimer.Enabled = true;
|
||||
fcTimer.Start();
|
||||
}
|
||||
|
||||
|
@ -187,6 +188,17 @@
|
|||
fcTimer.Enabled = true;
|
||||
fcTimer.Start();
|
||||
}
|
||||
|
||||
//合同绩效违规处理
|
||||
if (DateTime.Now.Hour == 10)
|
||||
{
|
||||
System.Timers.Timer fcTimer = new System.Timers.Timer();
|
||||
fcTimer.Elapsed += new System.Timers.ElapsedEventHandler(queTimer_ViolationHandling);
|
||||
//1小时执行一次
|
||||
fcTimer.Interval = 1000 * 60 * 60;
|
||||
fcTimer.Enabled = true;
|
||||
fcTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void queTimer_AutoSendOne(object sender, System.Timers.ElapsedEventArgs e)
|
||||
|
@ -1182,6 +1194,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
#region 自动填写评价
|
||||
/// <summary>
|
||||
/// 自动填写评价
|
||||
/// </summary>
|
||||
|
@ -1360,6 +1373,7 @@
|
|||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void FC_AutoStatus(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
|
@ -1577,6 +1591,153 @@
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region 合同绩效违规处理
|
||||
/// <summary>
|
||||
/// 合同绩效规格处理
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void queTimer_ViolationHandling(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
var foData = (from x in Funs.DB.FC_SESRelatedData where x.FC_Status != "Closed" select x).ToList();
|
||||
if (foData.Count() > 0)
|
||||
{
|
||||
foreach (var fo in foData)
|
||||
{
|
||||
string Contract_Admin = BLL.Sys_UserService.GetUserNameByUserId(fo.Contract_Admin);//合同管理员
|
||||
string Contractor = BLL.ContractorService.GetContractorById(fo.Contractor).ContractorCN;//承包商
|
||||
List<Model.Sys_User> userList = new List<Sys_User>();
|
||||
EmailPop pops = Funs.DB.EmailPop.FirstOrDefault(x => x.EmailID == BLL.Const.EmailPopId);
|
||||
if (pops == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string[] mailTo = null;
|
||||
string mailSubject = string.Empty;
|
||||
string mailBody = string.Empty;
|
||||
string mailPriority = string.Empty;
|
||||
string[] mailCC = null;
|
||||
string resultMessage = "";
|
||||
string userName = string.Empty;
|
||||
|
||||
string violation_type = string.Empty;//违规类型
|
||||
string consequence_action = string.Empty;//处理结果
|
||||
//零容忍违章
|
||||
var punishments = (from x in Funs.DB.EMC_Punishment where x.FO_NO == fo.FO_NO && x.Flag == "1" && x.ViolationDegree == "3" select x).ToList();
|
||||
if (punishments.Count == 1) //一次零容忍违章:约谈
|
||||
{
|
||||
violation_type = "一次零容忍违章";
|
||||
consequence_action = "约谈";
|
||||
}
|
||||
else if (punishments.Count == 3)//三次零容忍违章:NCR
|
||||
{
|
||||
violation_type = "三次零容忍违章";
|
||||
consequence_action = "NCR";
|
||||
}
|
||||
|
||||
DateTime startDate = DateTime.Now.AddMonths(-23);
|
||||
DateTime startTime = DateTime.Parse(startDate.Year + "-" + startDate.Month + "-01");
|
||||
DateTime endTime = DateTime.Parse(DateTime.Now.Year + "-" + DateTime.Now.Month + "-13");
|
||||
List<SqlParameter> yearToDateParam = new List<SqlParameter>();
|
||||
yearToDateParam.Add(new SqlParameter("@StartTime", startTime));
|
||||
yearToDateParam.Add(new SqlParameter("@EndTime", endTime));
|
||||
yearToDateParam.Add(new SqlParameter("@FoNo", fo.FO_NO));
|
||||
SqlParameter[] yearToDateParList = yearToDateParam.ToArray();
|
||||
var sesDataTable = SQLHelper.GetDataTableRunProc("Sp_ContractorEvaluation", yearToDateParList);
|
||||
|
||||
int s = 0;
|
||||
for (int i = 0; i < sesDataTable.Rows.Count; i++)
|
||||
{
|
||||
decimal sumScore = Convert.ToDecimal(sesDataTable.Rows[i]["SumScore"]);
|
||||
if (sumScore < 60)
|
||||
{
|
||||
s++;
|
||||
}
|
||||
}
|
||||
if (s >= 3)
|
||||
{
|
||||
violation_type = "累计三次月度评估低于60分";
|
||||
consequence_action = "不得参与下轮合同";
|
||||
}
|
||||
else
|
||||
{
|
||||
decimal? score = (from x in Funs.DB.FC_Score where x.Contract_No == fo.FO_NO select x).Sum(x => x.Score1 + x.Score2 + x.Score3 + x.Score4 + x.Score5 + x.Score6);
|
||||
if (s == 2 || score < 12)
|
||||
{
|
||||
violation_type = "累计两次月度评估低于60分或安全评估低于12分";
|
||||
consequence_action = "约谈";
|
||||
}
|
||||
}
|
||||
|
||||
var ncrs = (from x in Funs.DB.FC_ContractManagement where x.FC_ID == fo.ID && x.FileTypeId == "6" select x).ToList();
|
||||
if (ncrs.Count == 3)
|
||||
{
|
||||
violation_type = "三次NCR";
|
||||
consequence_action = "提前终止合同,不得参与下轮合同";
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(violation_type) && !string.IsNullOrEmpty(consequence_action))
|
||||
{
|
||||
//发送对应合同管理员
|
||||
var contractAdmin = from x in Funs.DB.Sys_User where x.UserId == fo.Contract_Admin && x.Email != null && x.Email != "" select x;
|
||||
if (contractAdmin.Count() > 0)
|
||||
{
|
||||
mailTo = contractAdmin.Select(x => x.Email).ToArray();
|
||||
userName = contractAdmin.First().UserName;
|
||||
}
|
||||
//抄送
|
||||
var cc = from x in Funs.DB.Sys_User
|
||||
join y in Funs.DB.Sys_Role on x.RoleId equals y.RoleId
|
||||
where x.Email != null && x.Email != ""
|
||||
&& (y.RoleName == "CTE/D Manager" || y.RoleName == "Cost Engineer Leader" || y.RoleName == "Contractor_Leader")
|
||||
select x;
|
||||
if (cc.Count() > 0)
|
||||
{
|
||||
foreach (var c in cc)
|
||||
{
|
||||
userList.Add(c);
|
||||
}
|
||||
}
|
||||
mailCC = userList.Select(x => x.Email).ToArray();
|
||||
|
||||
|
||||
if (mailTo == null || mailTo.Length == 0) return;
|
||||
var email = Funs.DB.SendEmail.Where(p => p.EmailStatus == "发送成功"
|
||||
&& p.EmailTile.Contains("合同绩效违规处理")
|
||||
&& p.EmailTile.Contains(fo.FO_NO) && mailTo.Contains(p.EmailURL));
|
||||
if (email.Count() > 0)
|
||||
{
|
||||
var emailurl = email.Select(p => p.EmailURL).ToList();
|
||||
mailTo = mailTo.Where(p => !emailurl.Contains(p)).ToArray();
|
||||
}
|
||||
var EmailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("合同绩效违规处理通知"));
|
||||
if (EmailTemplate.Count() > 0)
|
||||
{
|
||||
string templetpath = EmailTemplate.Select(p => p.EmailContext).FirstOrDefault();
|
||||
NameValueCollection myCol = new NameValueCollection();
|
||||
myCol.Add("ContractAdmin", Contract_Admin);//合同管理员
|
||||
myCol.Add("contract_number", fo.FO_NO);//合同号
|
||||
myCol.Add("Contractor_name", Contractor);//承包商名称
|
||||
myCol.Add("Contractor_contact", fo.MainHead);//承包商负责人
|
||||
myCol.Add("violation type", violation_type);//违规类型
|
||||
myCol.Add("consequence_action", consequence_action);//处理后果
|
||||
|
||||
mailBody = TemplateHelper.BulidByFile2(templetpath, myCol);
|
||||
|
||||
string mailName = EmailTemplate.Select(p => p.EmailName).FirstOrDefault();
|
||||
NameValueCollection myCol1 = new NameValueCollection();
|
||||
myCol1.Add("contract_number", fo.FO_NO);
|
||||
myCol1.Add("violation type", violation_type);
|
||||
mailSubject = TemplateHelper.BulidByFile2(mailName, myCol1);
|
||||
|
||||
MailHelper.SendNetMail2(pops, pops.EmailYx, mailTo, mailSubject, mailBody, mailPriority, mailCC, "一次", out resultMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void Sync_HR(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
//调用接口
|
||||
|
|
|
@ -55,16 +55,16 @@ namespace FineUIPro.Web.SES
|
|||
}
|
||||
|
||||
// BLL.SESRelatedDataService.InitFONoDropDownList(this.drpFO_No, true);//合同号
|
||||
//BLL.ContractorService.InitDropDownList(drpContractor, true); //承包商;
|
||||
var contractorLists = from x in Funs.DB.FC_SESRelatedData
|
||||
join y in Funs.DB.Base_Contractor on x.Contractor equals y.ContractorId
|
||||
where x.Expire_Date.Value.AddYears(1) >= DateTime.Now
|
||||
select new { y.ContractorId, Contractor = y.Contractor + y.ContractorCN };
|
||||
this.drpContractor.DataTextField = "Contractor";
|
||||
this.drpContractor.DataValueField = "ContractorId";
|
||||
this.drpContractor.DataSource = contractorLists.Distinct();
|
||||
this.drpContractor.DataBind();
|
||||
Funs.FineUIPleaseSelect(this.drpContractor);
|
||||
BLL.ContractorService.InitDropDownList(drpContractor, true); //承包商;
|
||||
//var contractorLists = from x in Funs.DB.FC_SESRelatedData
|
||||
// join y in Funs.DB.Base_Contractor on x.Contractor equals y.ContractorId
|
||||
// where x.Expire_Date.Value.AddYears(1) >= DateTime.Now
|
||||
// select new { y.ContractorId, Contractor = y.Contractor + y.ContractorCN };
|
||||
//this.drpContractor.DataTextField = "Contractor";
|
||||
//this.drpContractor.DataValueField = "ContractorId";
|
||||
//this.drpContractor.DataSource = contractorLists.Distinct();
|
||||
//this.drpContractor.DataBind();
|
||||
//Funs.FineUIPleaseSelect(this.drpContractor);
|
||||
|
||||
BLL.DepartService.InitDepartToWhere(this.drpBYC_RU, true);//BYC负责部门
|
||||
BLL.Sys_UserService.InitUserDropDownList(this.drpViolationInspector, true);//违章检查人
|
||||
|
|
Loading…
Reference in New Issue