diff --git a/FCL/BLL/Common/Const.cs b/FCL/BLL/Common/Const.cs index fc72436..c754923 100644 --- a/FCL/BLL/Common/Const.cs +++ b/FCL/BLL/Common/Const.cs @@ -57,6 +57,11 @@ namespace BLL /// public static string Role_CommonUsers = "bdb8c4fe-5082-4ce0-af5e-70f39f50ea41"; + /// + /// 承包商管理角色ID + /// + public static string Role_Contractor_LeaderId = "48b2376d-421f-4b12-b5be-c0c538bfe3e9"; + /// /// 邮件配置Id /// @@ -263,6 +268,11 @@ namespace BLL public const string BtnConTab13View = "承包商View"; #endregion + /// + /// 质量事件报告修改全部 + /// + public const string BtnModifyAll = "Modify All"; + #endregion #region 初始化上传路径 diff --git a/FCL/BLL/SES/PunishmentService.cs b/FCL/BLL/SES/PunishmentService.cs index c56d9e1..c2452c6 100644 --- a/FCL/BLL/SES/PunishmentService.cs +++ b/FCL/BLL/SES/PunishmentService.cs @@ -130,6 +130,7 @@ namespace BLL newPunishment.MainCoordinatorEndDate = punishment.MainCoordinatorEndDate; newPunishment.UserDepStartDate = punishment.UserDepStartDate; newPunishment.UserDepEndDate = punishment.UserDepEndDate; + newPunishment.Pause = punishment.Pause; Funs.DB.SubmitChanges(); } diff --git a/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigation.aspx.cs b/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigation.aspx.cs index 59dec68..17bea4b 100644 --- a/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigation.aspx.cs +++ b/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigation.aspx.cs @@ -50,6 +50,7 @@ namespace FineUIPro.Web.ContractorQuality left join Sys_User as u on u.UserId = p.Violation_Inspector left join Base_Depart as d on d.DepartId = u.DepartId left join Sys_User as du on du.UserId = d.DepartLeader + left join FC_SESRelatedData fo on fo.FO_NO = p.FO_NO where Flag='2' "; List listStr = new List(); var role = BLL.Sys_RoleService.GetRole(CurrUser.RoleId); @@ -72,7 +73,7 @@ namespace FineUIPro.Web.ContractorQuality var user = BLL.Sys_UserService.GetUsersByUserId(this.CurrUser.UserId); if (user != null) { - strSql += " and p.PunishmentId in (select PunishmentId from EMC_PunishmentAudit where (AuditMan='" + user.DepartId + "' or AuditMan='" + this.CurrUser.UserId + "') and AuditDate is null)"; + strSql += " and p.PunishmentId in (select PunishmentId from EMC_PunishmentAudit where ((AuditMan='" + user.DepartId + "' or AuditMan='" + this.CurrUser.UserId + "') and AuditDate is null) or (p.States='3' and p.MainCoordinatorEndDate is not null and p.UserDepStartDate is null and fo.Main_Coordinator='" + this.CurrUser.UserId + "'))"; } } } @@ -207,14 +208,32 @@ namespace FineUIPro.Web.ContractorQuality var user = BLL.Sys_UserService.GetUsersByUserId(this.CurrUser.UserId); if (user != null) { - if (pun.IsFrame == true && user.DepartId == pun.UserDep) + if ((pun.MainCoordinatorEndDate.HasValue && pun.MainCoordinatorEndDate.Value.AddDays(3) < DateTime.Now) || pun.UserDepStartDate.HasValue) { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("IncidentInvestigationEdit.aspx?punishmentId={0}", rowID, "编辑 - "))); + if (pun.IsFrame == true && user.DepartId == pun.UserDep) + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("IncidentInvestigationEdit.aspx?punishmentId={0}", rowID, "编辑 - "))); + } + else + { + var depart = BLL.DepartService.GetDepartNameById(pun.UserDep); + ShowAlert("您不是" + depart + "部门用户,不能操作!", MessageBoxIcon.Warning); + } } else { - var depart = BLL.DepartService.GetDepartNameById(pun.UserDep); - ShowAlert("您不是" + depart + "部门用户,不能操作!", MessageBoxIcon.Warning); + Model.FC_SESRelatedData fc = BLL.SESRelatedDataService.GetSESRelatedDataByFoNo(pun.FO_NO); + if (fc != null) + { + if (this.CurrUser.UserId == fc.Main_Coordinator || this.CurrUser.RoleId == BLL.Const.Role_Contractor_LeaderId)//当前用户等于主协调员 + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("IncidentInvestigationEdit.aspx?punishmentId={0}", rowID, "编辑 - "))); + } + else + { + ShowAlert("您不是" + BLL.Sys_UserService.GetUserNameByUserId(fc.Main_Coordinator) + ",不能操作!", MessageBoxIcon.Warning); + } + } } } } @@ -614,6 +633,8 @@ namespace FineUIPro.Web.ContractorQuality } #endregion + #region 格式化字符串 + #region 审批人 /// /// 审批人 /// @@ -655,7 +676,19 @@ namespace FineUIPro.Web.ContractorQuality } else if (pun.States == "3" && pun.IsFrame == true) { - name = BLL.DepartService.GetDepartNameById(pun.UserDep); + //承包商联系人有异议或3天未有动作 + if ((pun.MainCoordinatorEndDate.HasValue && pun.MainCoordinatorEndDate.Value.AddDays(3) < DateTime.Now) || pun.UserDepStartDate.HasValue) + { + name = BLL.DepartService.GetDepartNameById(pun.UserDep); + } + else + { + Model.FC_SESRelatedData fc = BLL.SESRelatedDataService.GetSESRelatedDataByFoNo(pun.FO_NO); + if (fc != null) + { + name = BLL.Sys_UserService.GetUserNameByUserId(fc.Main_Coordinator); + } + } } else if (pun.States == "4" && pun.IsFrame == true) { @@ -669,7 +702,9 @@ namespace FineUIPro.Web.ContractorQuality } return name; } + #endregion + #region 状态 /// /// 当期状态 /// @@ -697,13 +732,23 @@ namespace FineUIPro.Web.ContractorQuality } else { - s = "进行中"; + if (pun.Pause == true) + { + s = "已暂停"; + } + else + { + s = "进行中"; + } } } } return s; } + #endregion + #endregion + #region 筛选 /// /// 筛选 /// @@ -713,5 +758,6 @@ namespace FineUIPro.Web.ContractorQuality { BindGrid(); } + #endregion } } \ No newline at end of file diff --git a/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigationEdit.aspx b/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigationEdit.aspx index ce4d93e..0fe1dca 100644 --- a/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigationEdit.aspx +++ b/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigationEdit.aspx @@ -177,8 +177,8 @@ - - + + @@ -246,7 +246,8 @@ - + + @@ -273,7 +274,7 @@ - + @@ -313,10 +314,41 @@ + + + + + + @@ -331,6 +363,8 @@ + + diff --git a/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigationEdit.aspx.cs b/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigationEdit.aspx.cs index 6b68960..4cb021c 100644 --- a/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigationEdit.aspx.cs +++ b/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigationEdit.aspx.cs @@ -1,7 +1,9 @@ using BLL; using BLL.Common; +using NPOI.POIFS.Crypt.Dsig; using Org.BouncyCastle.Bcpg.OpenPgp; using System; +using System.Collections.Generic; using System.Collections.Specialized; using System.Drawing; using System.Linq; @@ -69,7 +71,6 @@ namespace FineUIPro.Web.ContractorQuality this.PunishmentId = Request.Params["punishmentId"]; if (!string.IsNullOrEmpty(this.PunishmentId)) { - var att1 = from x in Funs.DB.AttachFile where x.ToKeyId == this.PunishmentId + "#1" select x; if (att1.Count() == 0) { @@ -107,6 +108,9 @@ namespace FineUIPro.Web.ContractorQuality GroupPanel3.Hidden = false; GroupPanel4.Hidden = false; GroupPanel5.Hidden = false; + frModifyDef.Hidden = false; + frModifyDefUrl.Hidden = false; + //frPassResult.Hidden = false; var audit = BLL.PunishmentAuditService.GetAuditBypunishmentIdAndAuditMan(this.PunishmentId, this.CurrUser.UserId); if (pun.IsPass == false && audit != null) @@ -308,15 +312,44 @@ namespace FineUIPro.Web.ContractorQuality } else if (pun.States == "3" && pun.IsFrame == true)//用户部门填写 { - //GroupPanel1.Enabled = false; - GroupPanel1Enabled(); GroupPanel2.Hidden = false; - GroupPanel2.Enabled = false; - //GroupPanel3.Enabled = false; - GroupPanel3Enabled(); GroupPanel3.Hidden = false; GroupPanel4.Hidden = false; this.btnSbumit.Hidden = false; + //用户部门操作前主协调员可暂停 + Model.FC_SESRelatedData fc = BLL.SESRelatedDataService.GetSESRelatedDataByFoNo(pun.FO_NO); + if (fc != null) + { + if (this.CurrUser.UserId == fc.Main_Coordinator)//当前用户等于主协调员 + { + Panel4.Hidden = false; + if (pun.MainCoordinatorEndDate.HasValue && pun.MainCoordinatorEndDate.Value.AddDays(3) >= DateTime.Now) + { + this.btnPause.Hidden = false; + //this.btnSave.Hidden = true; + //this.btnSbumit.Hidden = true; + this.GroupPanel4.Hidden = true; + } + if (pun.Pause == true) + { + this.btnPause.Hidden = true; + this.frPassResult.Hidden = false; + } + } + // 承包商管理角色可编辑提交后的申报人填写、SSR填写、主协调员填写内容 + if (this.CurrUser.RoleId == BLL.Const.Role_Contractor_LeaderId) + { + GroupPanel1.Enabled = true; + GroupPanel2.Enabled = true; + GroupPanel3.Enabled = true; + GroupPanel4.Hidden = true; + frModifyDef.Hidden = false; + frModifyDefUrl.Hidden = false; + this.btnSave.Hidden = true; + this.btnSbumit.Hidden = true; + this.btnSureModify.Hidden = false; + } + } } else if (pun.States == "4" && pun.IsFrame == true)//合同管理员填写 { @@ -490,7 +523,9 @@ namespace FineUIPro.Web.ContractorQuality this.txtIndividualSESReason.Text = pun.IndividualSESReason; this.txtSESReson.Text = pun.SESReason; this.txtBuyerReson.Text = pun.BuyerReson; - #endregion + this.hdModifyContent.Text = pun.ModifyContent; + this.txtModifyDef.Text = pun.ModifyContent; + #endregion } } else @@ -500,7 +535,7 @@ namespace FineUIPro.Web.ContractorQuality } } } - + #region 不可编辑 /// /// 申报人填写不可编辑 /// @@ -551,6 +586,7 @@ namespace FineUIPro.Web.ContractorQuality Label10.Enabled = false; } #endregion + #endregion #region 保存、提交 /// @@ -577,6 +613,7 @@ namespace FineUIPro.Web.ContractorQuality { if (!string.IsNullOrEmpty(this.PunishmentId)) { + List emialLists = new List(); //承包商联系人Email var pun = BLL.PunishmentService.GetPunishmentById(this.PunishmentId); if (pun != null) { @@ -596,6 +633,10 @@ namespace FineUIPro.Web.ContractorQuality { pun.ContractAdmin = this.drpContractAdmin.SelectedValue; } + if (!string.IsNullOrEmpty(fc.Email)) + { + emialLists.Add(fc.Email);//承包商联系人Email + } } else { @@ -759,7 +800,7 @@ namespace FineUIPro.Web.ContractorQuality { pun.States = "3";//主协调员提交 pun.MainCoordinatorEndDate = DateTime.Now;//主协调员审批时间 - pun.UserDepStartDate = DateTime.Now;//用户部门审批到达时间 + //pun.UserDepStartDate = DateTime.Now;//用户部门审批到达时间 var updateAudit = BLL.PunishmentAuditService.GetAuditByAuditMan(this.PunishmentId, this.CurrUser.UserId); if (updateAudit != null) @@ -769,14 +810,14 @@ namespace FineUIPro.Web.ContractorQuality updateAudit.IsPass = true; BLL.PunishmentAuditService.UpdatePunishmentAudit(updateAudit); } + //通知承包商联系人,有3天反馈时间,若3天后未处理,进入下一审批,否则暂停重新评估 + //Model.EMC_PunishmentAudit audit = new Model.EMC_PunishmentAudit(); + //audit.AuditId = SQLHelper.GetNewID(typeof(Model.EMC_PunishmentAudit)); + //audit.PunishmentId = this.PunishmentId; + //audit.AuditMan = pun.UserDep; + //BLL.PunishmentAuditService.AddPunishmentAudit(audit); - Model.EMC_PunishmentAudit audit = new Model.EMC_PunishmentAudit(); - audit.AuditId = SQLHelper.GetNewID(typeof(Model.EMC_PunishmentAudit)); - audit.PunishmentId = this.PunishmentId; - audit.AuditMan = pun.UserDep; - BLL.PunishmentAuditService.AddPunishmentAudit(audit); - - #region 主协调员审批通过邮件:发送给部门经理,抄送流程经办人 + #region 主协调员通过-通知承包商联系人 Model.EmailPop pops = Funs.DB.EmailPop.FirstOrDefault(x => x.EmailID == BLL.Const.EmailPopId); if (pops == null) { @@ -786,44 +827,76 @@ namespace FineUIPro.Web.ContractorQuality string[] mailCC = null; string resultMessage = ""; - var emailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("主协调员填写完成后审批通过通知")); + var emailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("承包商联系人通知")); if (emailTemplate.Count() > 0) { - string departLeader = string.Empty; - var depart = BLL.DepartService.GetDepartById(drpUserDep.SelectedValue); - if (depart != null) - { - departLeader = depart.DepartLeader; - } - if (!string.IsNullOrEmpty(departLeader)) - { - var userTo = from x in Funs.DB.Sys_User - where x.UserId.Contains(departLeader) && 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 userTo = from x in Funs.DB.Sys_User + // where x.RoleId == BLL.Const.Role_Contractor_LeaderId && x.Email != null && x.Email != "" + // select x; + //if (userTo != null) + //{ + // mailTo = userTo.Select(x => x.Email).ToArray(); + //} + mailTo = emialLists.ToArray(); if (mailTo.Length > 0) { NameValueCollection myPram = new NameValueCollection(); myPram.Add("发现日期", pun.PunishDate != null ? pun.PunishDate.Value.ToString("yyyy-MM-dd") : ""); myPram.Add("位置", pun.Location); myPram.Add("质量事件描述", pun.Description); - MailHelper.SendPunishSesMail(pops, myPram, "主协调员填写完成后审批通过通知", mailTo, mailCC, out resultMessage); + MailHelper.SendPunishSesMail(pops, myPram, "承包商联系人通知", mailTo, mailCC, out resultMessage); } } #endregion + + #region 主协调员审批通过邮件:发送给部门经理,抄送流程经办人 + //Model.EmailPop pops = Funs.DB.EmailPop.FirstOrDefault(x => x.EmailID == BLL.Const.EmailPopId); + //if (pops == null) + //{ + // return; + //} + //string[] mailTo = null; + //string[] mailCC = null; + //string resultMessage = ""; + + //var emailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("主协调员填写完成后审批通过通知")); + //if (emailTemplate.Count() > 0) + //{ + // string departLeader = string.Empty; + // var depart = BLL.DepartService.GetDepartById(drpUserDep.SelectedValue); + // if (depart != null) + // { + // departLeader = depart.DepartLeader; + // } + // if (!string.IsNullOrEmpty(departLeader)) + // { + // var userTo = from x in Funs.DB.Sys_User + // where x.UserId.Contains(departLeader) && 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(); + // myPram.Add("发现日期", pun.PunishDate != null ? pun.PunishDate.Value.ToString("yyyy-MM-dd") : ""); + // myPram.Add("位置", pun.Location); + // myPram.Add("质量事件描述", pun.Description); + // MailHelper.SendPunishSesMail(pops, myPram, "主协调员填写完成后审批通过通知", mailTo, mailCC, out resultMessage); + // } + //} + #endregion } } else //非框架合同 @@ -974,87 +1047,194 @@ namespace FineUIPro.Web.ContractorQuality } else if (pun.States == "3")//用户部门提交 { - if (!string.IsNullOrEmpty(this.txtIndividualSES.Text.Trim())) + var user = BLL.Sys_UserService.GetUsersByUserId(this.CurrUser.UserId); + if (user != null) { - pun.ViolationRelatedSes = this.txtIndividualSES.Text.Trim(); - } - else - { - if (!string.IsNullOrEmpty(this.txtIndividualSESReason.Text.Trim())) + if (user.DepartId == pun.UserDep) { - pun.IndividualSESReason = this.txtIndividualSESReason.Text.Trim(); + if (!string.IsNullOrEmpty(this.txtIndividualSES.Text.Trim())) + { + pun.ViolationRelatedSes = this.txtIndividualSES.Text.Trim(); + } + else + { + if (!string.IsNullOrEmpty(this.txtIndividualSESReason.Text.Trim())) + { + pun.IndividualSESReason = this.txtIndividualSESReason.Text.Trim(); + } + else + { + Alert.ShowInTop("如不填写,请描述原因!", MessageBoxIcon.Warning); + return; + } + } + if (type == BLL.Const.BtnSubmit) + { + pun.States = "4";//用户部门提交 + pun.UserDepEndDate = DateTime.Now;//用户部门审批时间 + + var u = BLL.Sys_UserService.GetUsersByUserId(this.CurrUser.UserId); + if (u != null) + { + var updateAudit = BLL.PunishmentAuditService.GetAuditByAuditMan(this.PunishmentId, u.DepartId); + if (updateAudit != null) + { + updateAudit.AuditMan = this.CurrUser.UserId; + updateAudit.AuditDate = DateTime.Now; + updateAudit.IsPass = true; + BLL.PunishmentAuditService.UpdatePunishmentAudit(updateAudit); + } + } + + Model.EMC_PunishmentAudit audit = new Model.EMC_PunishmentAudit(); + audit.AuditId = SQLHelper.GetNewID(typeof(Model.EMC_PunishmentAudit)); + audit.PunishmentId = this.PunishmentId; + audit.AuditMan = pun.ContractAdmin; + BLL.PunishmentAuditService.AddPunishmentAudit(audit); + + #region 用户部门填写后审批邮件:发送给合同管理员,抄送给流程经办人 + Model.EmailPop pops = Funs.DB.EmailPop.FirstOrDefault(x => x.EmailID == BLL.Const.EmailPopId); + if (pops == null) + { + return; + } + string[] mailTo = null; + string[] mailCC = null; + string resultMessage = ""; + + var emailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("用户部门填写后审核通知")); + if (emailTemplate.Count() > 0) + { + var userTo = from x in Funs.DB.Sys_User + where x.UserId.Contains(this.drpContractAdmin.SelectedValue) + && 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(); + myPram.Add("发现日期", pun.PunishDate != null ? pun.PunishDate.Value.ToString("yyyy-MM-dd") : ""); + myPram.Add("位置", pun.Location); + myPram.Add("质量事件描述", pun.Description); + MailHelper.SendPunishSesMail(pops, myPram, "用户部门填写后审核通知", mailTo, mailCC, out resultMessage); + } + } + #endregion + } } else { - Alert.ShowInTop("如不填写,请描述原因!", MessageBoxIcon.Warning); - return; - } - } - if (type == BLL.Const.BtnSubmit) - { - pun.States = "4";//用户部门提交 - pun.UserDepEndDate = DateTime.Now;//用户部门审批时间 - - var u = BLL.Sys_UserService.GetUsersByUserId(this.CurrUser.UserId); - if (u != null) - { - var updateAudit = BLL.PunishmentAuditService.GetAuditByAuditMan(this.PunishmentId, u.DepartId); - if (updateAudit != null) + #region 最终审核通过,发送给用户部门办理,未通过发送给所有经办人 + Model.View_FC_SESRelatedData fc = BLL.SESRelatedDataService.GetSESRelatedDataViewByFO(pun.FO_NO); + if (fc != null) { - updateAudit.AuditMan = this.CurrUser.UserId; - updateAudit.AuditDate = DateTime.Now; - updateAudit.IsPass = true; - BLL.PunishmentAuditService.UpdatePunishmentAudit(updateAudit); + if (this.CurrUser.UserId == fc.Main_CoordinatorId && type == BLL.Const.BtnSubmit) + { + if (rblPass.SelectedValue == "True") + { + pun.UserDepStartDate = DateTime.Now;//用户部门审批到达时间 + pun.Pause = false;//如果审核通过,取消暂停 + + #region 主协调员审批通过邮件:发送给部门经理,抄送流程经办人 + Model.EmailPop pops = Funs.DB.EmailPop.FirstOrDefault(x => x.EmailID == BLL.Const.EmailPopId); + if (pops == null) + { + return; + } + string[] mailTo = null; + string[] mailCC = null; + string resultMessage = ""; + + var emailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("主协调员填写完成后审批通过通知")); + if (emailTemplate.Count() > 0) + { + string departLeader = string.Empty; + var depart = BLL.DepartService.GetDepartById(drpUserDep.SelectedValue); + if (depart != null) + { + departLeader = depart.DepartLeader; + } + if (!string.IsNullOrEmpty(departLeader)) + { + var userTo = from x in Funs.DB.Sys_User + where x.UserId.Contains(departLeader) && 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(); + myPram.Add("发现日期", pun.PunishDate != null ? pun.PunishDate.Value.ToString("yyyy-MM-dd") : ""); + myPram.Add("位置", pun.Location); + myPram.Add("质量事件描述", pun.Description); + MailHelper.SendPunishSesMail(pops, myPram, "主协调员填写完成后审批通过通知", mailTo, mailCC, out resultMessage); + } + } + #endregion + } + else//最终审核未通过通知 + { + pun.States = "7";//已拒绝 + + Model.EmailPop pops = Funs.DB.EmailPop.FirstOrDefault(x => x.EmailID == BLL.Const.EmailPopId); + if (pops == null) + { + return; + } + string[] mailTo = null; + //string[] mailCC = null; + string resultMessage = ""; + + var emailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("主协调员填写完成后审批未通过通知")); + if (emailTemplate.Count() > 0) + { + var userTo = 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 (userTo != null) + { + mailTo = userTo.Select(x => x.Email).Distinct().ToArray(); + } + if (mailTo.Length > 0) + { + NameValueCollection myPram = new NameValueCollection(); + myPram.Add("发现日期", pun.PunishDate != null ? pun.PunishDate.Value.ToString("yyyy-MM-dd") : ""); + myPram.Add("位置", pun.Location); + myPram.Add("质量事件描述", pun.Description); + MailHelper.SendPunishSesMail(pops, myPram, "主协调员填写完成后审批未通过通知", mailTo, null, out resultMessage); + } + } + } + } } + #endregion } - - Model.EMC_PunishmentAudit audit = new Model.EMC_PunishmentAudit(); - audit.AuditId = SQLHelper.GetNewID(typeof(Model.EMC_PunishmentAudit)); - audit.PunishmentId = this.PunishmentId; - audit.AuditMan = pun.ContractAdmin; - BLL.PunishmentAuditService.AddPunishmentAudit(audit); - - #region 用户部门填写后审批邮件:发送给合同管理员,抄送给流程经办人 - Model.EmailPop pops = Funs.DB.EmailPop.FirstOrDefault(x => x.EmailID == BLL.Const.EmailPopId); - if (pops == null) - { - return; - } - string[] mailTo = null; - string[] mailCC = null; - string resultMessage = ""; - - var emailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("用户部门填写后审核通知")); - if (emailTemplate.Count() > 0) - { - var userTo = from x in Funs.DB.Sys_User - where x.UserId.Contains(this.drpContractAdmin.SelectedValue) - && 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(); - myPram.Add("发现日期", pun.PunishDate != null ? pun.PunishDate.Value.ToString("yyyy-MM-dd") : ""); - myPram.Add("位置", pun.Location); - myPram.Add("质量事件描述", pun.Description); - MailHelper.SendPunishSesMail(pops, myPram, "用户部门填写后审核通知", mailTo, mailCC, out resultMessage); - } - } - #endregion } } else if (pun.States == "4")//合同管理员 @@ -1699,12 +1879,12 @@ namespace FineUIPro.Web.ContractorQuality PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader2.aspx?type=view&toKeyId={0}&path=FileUpload/SES/EMC_Punishment&menuId={1}&strParam=1", this.hdId.Text, BLL.Const.IncidentInvestigationMenuId))); } - /// - /// 质量调查相关附件 - /// - /// - /// - protected void btnAttach2_Click(object sender, EventArgs e) + /// + /// 质量调查相关附件 + /// + /// + /// + protected void btnAttach2_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录 { @@ -1722,6 +1902,31 @@ namespace FineUIPro.Web.ContractorQuality { PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader2.aspx?type=view&toKeyId={0}&path=FileUpload/SES/EMC_Punishment&menuId={1}&strParam=2", this.PunishmentId, BLL.Const.IncidentInvestigationMenuId))); } + + #region 修改内容说明附件 + /// + /// 上传 + /// + /// + /// + protected void btnModifyAttach_Click(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(this.hdId.Text)) + { + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader2.aspx?type=edit&toKeyId={0}&path=FileUpload/SES/EMC_Punishment&menuId={1}&strParam=3", this.PunishmentId, BLL.Const.IncidentInvestigationMenuId))); + } + } + + /// + /// 查看 + /// + /// + /// + protected void lbtnModifyAttach_Click(object sender, EventArgs e) + { + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader2.aspx?type=view&toKeyId={0}&path=FileUpload/SES/EMC_Punishment&menuId={1}&strParam=3", this.PunishmentId, BLL.Const.IncidentInvestigationMenuId))); + } + #endregion #endregion #region 拒绝 @@ -1771,8 +1976,155 @@ namespace FineUIPro.Web.ContractorQuality { PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } + #endregion + #region 暂停 + /// + /// 承包商联系人有异议线下通知主协调员,主协调员可暂停重新评估 + /// + /// + /// + protected void btnPause_Click(object sender, EventArgs e) + { + var pun = BLL.PunishmentService.GetPunishmentById(this.PunishmentId); + if (pun != null) + { + pun.Pause = true; + pun.PauseDate = DateTime.Now; + Funs.DB.SubmitChanges(); + ShowNotify("已暂停,请联合发起人及承包商调查审核!", MessageBoxIcon.Information); + } + } + #endregion + #region 保存修改 + /// + /// 确认修改 + /// + /// + /// + protected void btnSureModify_Click(object sender, EventArgs e) + { + string con = string.Empty; + if (!string.IsNullOrEmpty(this.PunishmentId)) + { + var pun = BLL.PunishmentService.GetPunishmentById(this.PunishmentId); + if (pun != null) + { + if (pun.States == "3" && !pun.UserDepStartDate.HasValue && rblSeType.SelectedValue == "1") + { + Model.View_FC_SESRelatedData fc = BLL.SESRelatedDataService.GetSESRelatedDataViewByFO(pun.FO_NO); + if (fc != null) + { + #region 承包商管理角色可修改用户部门前的所有内容 + if (this.CurrUser.RoleId == BLL.Const.Role_Contractor_LeaderId) + { + if (pun.PunishDate.Value.ToShortDateString() != Funs.GetNewDateTime(this.txtPunishDate.Text.Trim()).Value.ToShortDateString()) + { + con += "发现日期由【" + string.Format("{0:yyyy-MM-dd}", pun.PunishDate) + "】改为【" + string.Format("{0:yyyy-MM-dd}", Funs.GetNewDateTime(this.txtPunishDate.Text.Trim())) + "】;"; + pun.PunishDate = Funs.GetNewDateTime(this.txtPunishDate.Text.Trim()); + } + if (pun.Location != this.txtLocation.Text.Trim()) + { + con += "位置由【" + pun.Location + "】改为【" + this.txtLocation.Text.Trim() + "】;"; + pun.Location = this.txtLocation.Text.Trim(); + } + if (pun.Description != this.txtDescription.Text.Trim()) + { + con += "质量事件描述由【" + pun.Description + "】改为【" + this.txtDescription.Text.Trim() + "】;"; + pun.Description = this.txtDescription.Text.Trim(); + } + if (pun.MIContractor != this.txtMIContractor.Text.Trim()) + { + con += "可能涉及的承包商由【" + pun.MIContractor + "】改为【" + this.txtMIContractor.Text.Trim() + "】;"; + pun.MIContractor = this.txtMIContractor.Text.Trim(); + } + if (pun.SeType != this.rblSeType.SelectedValue) + { + con += "类型由【" + pun.SeType == "1" ? "服务" : "物资" + "】改为【" + this.rblSeType.SelectedValue == "1" ? "服务" : "物资" + "】;"; + pun.SeType = this.rblSeType.SelectedValue; + } + if (pun.FO_NO != this.txtFO_No.Text.Trim()) + { + con += "合同号由【" + pun.FO_NO + "】改为【" + this.txtFO_No.Text.Trim() + "】;"; + pun.FO_NO = this.txtFO_No.Text.Trim(); + } + if (pun.Contractor != this.txtContractor.Text.Trim()) + { + con += "涉及承包商由【" + pun.Contractor + "】改为【" + this.txtContractor.Text.Trim() + "】;"; + pun.Contractor = this.txtContractor.Text.Trim(); + } + if (pun.ContractAdmin != this.drpContractAdmin.SelectedValue) + { + if (this.drpContractAdmin.SelectedValue != BLL.Const._Null) + { + con += "合同管理员由【" + Sys_UserService.GetUserNameByUserId(pun.Contractor) + "】改为【" + Sys_UserService.GetUserNameByUserId(this.drpContractAdmin.SelectedValue) + "】;"; + pun.ContractAdmin = this.drpContractAdmin.SelectedValue; + } + } + if (pun.ContractRequester != this.drpContractRequester.SelectedValue) + { + if (this.drpContractRequester.SelectedValue != BLL.Const._Null) + { + con += "合同需求人由【" + Sys_UserService.GetUserNameByUserId(pun.ContractRequester) + "】改为【" + Sys_UserService.GetUserNameByUserId(this.drpContractRequester.SelectedValue) + "】;"; + pun.ContractRequester = this.drpContractRequester.SelectedValue; + } + } + //if (pun.ContractRequesterDep != txtContractRequesterDep.Text.Trim()) + //{ + // con += "需求人部门由" + pun.ContractRequesterDep + "改为" + txtContractRequesterDep.Text.Trim() + ";"; + // pun.ContractRequester = this.drpContractRequester.SelectedValue; + //} + //if (pun.Buyer != this.drpBuyer.SelectedValue) + //{ + // con += "采购员由" + Sys_UserService.GetUserNameByUserId(pun.Buyer) + "改为" + Sys_UserService.GetUserNameByUserId(this.drpBuyer.SelectedValue) + ";"; + // pun.ContractRequester = this.drpContractRequester.SelectedValue; + //} + if (pun.ViolationDegree != this.drpViolationDegree.SelectedValue) + { + if (this.drpViolationDegree.SelectedValue != BLL.Const._Null) + { + con += "违章条款由【" + BLL.ViolationClauseService.GetViolationClause(pun.ViolationDegree).ClauseDef + "】改为【" + BLL.ViolationClauseService.GetViolationClause(this.drpViolationDegree.SelectedValue).ClauseDef + "】;"; + pun.ViolationDegree = this.drpViolationDegree.SelectedValue; + } + } + if (pun.Company != Funs.GetNewDecimal(this.txtCompany.Text.Trim())) + { + con += "违章扣款(公司)由【" + pun.Company + "】改为【" + Funs.GetNewDecimal(this.txtCompany.Text.Trim()) + "】;"; + pun.Company = Funs.GetNewDecimal(this.txtCompany.Text.Trim()); + } + if (pun.IndividualPerson != this.txtIndividualPerson.Text.Trim()) + { + con += "违章人员由【" + pun.IndividualPerson + "】改为【" + this.txtIndividualPerson.Text.Trim() + "】;"; + pun.IndividualPerson = this.txtIndividualPerson.Text.Trim(); + } + if (pun.Individual != Funs.GetNewDecimal(this.txtIndividual.Text.Trim())) + { + con += "违章扣款(个人)由【" + pun.Individual + "】改为【" + Funs.GetNewDecimal(this.txtIndividual.Text.Trim()) + "】;"; + pun.Individual = Funs.GetNewDecimal(this.txtIndividual.Text.Trim()); + } + if (pun.UserDep != this.drpUserDep.SelectedValue) + { + if (this.drpUserDep.SelectedValue != BLL.Const._Null) + { + con += "用户部门由【" + DepartService.GetDepartNameById(pun.UserDep) + "】改为【" + DepartService.GetDepartNameById(this.drpUserDep.SelectedValue) + "】;"; + pun.UserDep = this.drpUserDep.SelectedValue; + } + } + this.txtModifyDef.Text = this.hdModifyContent.Text + con; + pun.ModifyContent = this.txtModifyDef.Text.Trim(); + pun.Modifyer = this.CurrUser.UserId; + pun.ModifyDate = DateTime.Now; + Funs.DB.SubmitChanges(); + ShowNotify("修改成功!", MessageBoxIcon.Success); + } + #endregion + } + } + } + } + } + #endregion } } \ No newline at end of file diff --git a/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigationEdit.aspx.designer.cs b/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigationEdit.aspx.designer.cs index 50b947b..6bd08a3 100644 --- a/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigationEdit.aspx.designer.cs +++ b/FCL/FineUIPro.Web/ContractorQuality/IncidentInvestigationEdit.aspx.designer.cs @@ -761,6 +761,105 @@ namespace FineUIPro.Web.ContractorQuality /// protected global::FineUIPro.TextBox txtBuyerReson; + /// + /// frModifyDef 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FormRow frModifyDef; + + /// + /// txtModifyDef 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtModifyDef; + + /// + /// frModifyDefUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FormRow frModifyDefUrl; + + /// + /// Panel4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel4; + + /// + /// Label13 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label13; + + /// + /// btnModifyAttach 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnModifyAttach; + + /// + /// Label14 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label14; + + /// + /// lbtnModifyAttach 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.LinkButton lbtnModifyAttach; + + /// + /// frPassResult 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FormRow frPassResult; + + /// + /// rblPass 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.RadioButtonList rblPass; + + /// + /// Label15 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label15; + /// /// Toolbar1 控件。 /// @@ -770,6 +869,15 @@ namespace FineUIPro.Web.ContractorQuality /// protected global::FineUIPro.Toolbar Toolbar1; + /// + /// hdModifyContent 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdModifyContent; + /// /// hdId 控件。 /// @@ -824,6 +932,24 @@ namespace FineUIPro.Web.ContractorQuality /// protected global::FineUIPro.Button btnSbumit; + /// + /// btnPause 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnPause; + + /// + /// btnSureModify 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSureModify; + /// /// Window1 控件。 /// diff --git a/FCL/FineUIPro.Web/Global.asax.cs b/FCL/FineUIPro.Web/Global.asax.cs index 6a55403..7069fcf 100644 --- a/FCL/FineUIPro.Web/Global.asax.cs +++ b/FCL/FineUIPro.Web/Global.asax.cs @@ -48,15 +48,14 @@ //每月(2,5,8,10)邮件自动发送给SSR提交人员和主协调人及合同员,用户代表等评价 - if ((DateTime.Now.Day == 2 || DateTime.Now.Day == 5 || DateTime.Now.Day == 8 || DateTime.Now.Day == 10)) + if ((DateTime.Now.Day == 2 || DateTime.Now.Day == 5 || DateTime.Now.Day == 8 || DateTime.Now.Day == 10) && DateTime.Now.Hour == 8) { System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Elapsed += new System.Timers.ElapsedEventHandler(aTimer_Elapsed); - //60分钟执行一次 - aTimer.Interval = 1000 * 60 * 60; + //30分钟执行一次 + aTimer.Interval = 1000 * 60 * 30; aTimer.Enabled = true; aTimer.Start(); - } //自动填写评价 if (DateTime.Now.Day == 12) @@ -64,7 +63,7 @@ System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Elapsed += new System.Timers.ElapsedEventHandler(aTimer_AutoFill); //30分钟执行一次 - aTimer.Interval = 1800000; + aTimer.Interval = 1000 * 60 * 30; aTimer.Enabled = true; aTimer.Start(); @@ -199,6 +198,17 @@ fcTimer.Enabled = true; fcTimer.Start(); } + + //承包商报告主协调员提交后通知承包商联系人,若无异议或3天未操作,发送邮件给用户部门经理 + if (DateTime.Now.Hour == 9) + { + System.Timers.Timer fcTimer = new System.Timers.Timer(); + fcTimer.Elapsed += new System.Timers.ElapsedEventHandler(PunTimer_PunishmentTimer); + //1小时执行一次 + fcTimer.Interval = 1000 * 60 * 60; + fcTimer.Enabled = true; + fcTimer.Start(); + } } private void queTimer_AutoSendOne(object sender, System.Timers.ElapsedEventArgs e) @@ -242,7 +252,7 @@ userName = contractAdmin.First().UserName; departId = contractAdmin.First().DepartId; } - + var depart = BLL.DepartService.GetDepartById(departId); if (depart != null) { @@ -321,9 +331,9 @@ if (que.QueType == "3") { var cts = 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 == "CTS/S") - select x; + join y in Funs.DB.Sys_Role on x.RoleId equals y.RoleId + where x.Email != null && x.Email != "" && (y.RoleName == "CTS/S") + select x; if (cts.Count() > 0) { mailTo = cts.Select(x => x.Email).ToArray(); @@ -436,12 +446,12 @@ myCol.Add("Contractor_En", contractor.Contractor); myCol.Add("Expire_En", que.LimitEndDate.Value.ToShortDateString()); - + myCol.Add("ContractNo", fo.FO_NO); - myCol.Add("Contractor", (contractor.ContractorCN != null && contractor.ContractorCN!="") ? contractor.ContractorCN : contractor.Contractor); + myCol.Add("Contractor", (contractor.ContractorCN != null && contractor.ContractorCN != "") ? contractor.ContractorCN : contractor.Contractor); myCol.Add("QuaName", que.QueName); myCol.Add("Expire", que.LimitEndDate.Value.ToShortDateString()); - + mailBody = TemplateHelper.BulidByFile2(templetpath, myCol); string mailName = EmailTemplate.Select(p => p.EmailName).FirstOrDefault(); @@ -482,7 +492,7 @@ } string[] mailTo = null; string mailBody = string.Empty; - + string mailSubject = string.Empty; string mailPriority = string.Empty; string[] mailCC = null; @@ -718,13 +728,13 @@ } private void aTimer_AutoSend(object sender, System.Timers.ElapsedEventArgs e) - { + { // 过期提示,30天范围 - var foList = from x in Funs.DB.FC_SESRelatedData where x.Expire_Date != null + var foList = from x in Funs.DB.FC_SESRelatedData where x.Expire_Date != null && x.Expire_Date.Value.AddMonths(-6).AddDays(-7).Date <= DateTime.Now.Date && x.Expire_Date.Value.AddMonths(-5).AddDays(-7).Date >= DateTime.Now.Date select x; - if (foList.Count() > 0) + if (foList.Count() > 0) { foreach (var fo in foList) { @@ -812,7 +822,7 @@ var cost = from x in Funs.DB.Sys_User join y in Funs.DB.Sys_Role on x.RoleId equals y.RoleId join z in Funs.DB.Base_Depart on x.DepartId equals z.DepartId - where (y.RoleName == "Cost Engineer Leader" || y.RoleName == "Contractor_Leader" || z.DepartCode== "CT/K") && x.Email != null && x.Email != "" + where (y.RoleName == "Cost Engineer Leader" || y.RoleName == "Contractor_Leader" || z.DepartCode == "CT/K") && x.Email != null && x.Email != "" select x; if (cost.Count() > 0) { @@ -841,8 +851,8 @@ 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" || x.UserId== deparatLeader || y.RoleName == "CGP Director" || (y.RoleName== "CT Director" && x.DepartId== departId)) + where x.Email != null && x.Email != "" + && (y.RoleName == "CTE/D Manager" || x.UserId == deparatLeader || y.RoleName == "CGP Director" || (y.RoleName == "CT Director" && x.DepartId == departId)) select x; mailTo = userList.Select(x => x.Email).ToArray(); @@ -850,7 +860,7 @@ //var nowDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00"); //&& p.CreateTime.Value >= nowDate - var email = Funs.DB.SendEmail.Where(p => p.EmailStatus == "发送成功" + var email = Funs.DB.SendEmail.Where(p => p.EmailStatus == "发送成功" && p.EmailTile.Contains("到期提醒") && p.EmailTile.Contains(discipline.Discipline.Replace("\r\n", "")) && p.EmailTile.Contains(fo.FO_NO) && mailTo.Contains(p.EmailURL)).ToList(); if (email.Count > 0) @@ -901,7 +911,7 @@ string resultMessage = ""; string departId = string.Empty; - + var discipline = BLL.DisciplineService.GetDisciplineById(fo.DisciplineId); //string disc = discipline.Discipline; //if (!string.IsNullOrEmpty(discipline.DisciplineCN)) @@ -917,7 +927,7 @@ var buyer = from x in Funs.DB.Sys_User where x.UserId == fo.BuyerId && x.Email != null && x.Email != "" select x; if (buyer.Count() > 0) { - userList.Add(buyer.First()); + userList.Add(buyer.First()); } var mainCoor = from x in Funs.DB.Sys_User where x.UserId == fo.Main_Coordinator && x.Email != null && x.Email != "" select x; if (mainCoor.Count() > 0) @@ -929,7 +939,7 @@ { userList.Add(userRepresentative.First()); } - + //var ctk = from x in Funs.DB.Sys_User // join z in Funs.DB.Base_Depart on x.DepartId equals z.DepartId // where z.DepartCode == "CT/K" && x.Email != null && x.Email != "" @@ -987,6 +997,7 @@ } #endregion + #region 每月(2,5,8,10)邮件自动发送给SSR提交人员和主协调人及合同员,用户代表等评价 /// /// 每月(2,5,8,10)邮件自动发送给SSR提交人员和主协调人及合同员,用户代表等评价 /// @@ -1094,7 +1105,7 @@ { mailCC = mailCCLs.Where(p => !string.IsNullOrEmpty(p)).ToArray(); } - + } // 总监 @@ -1102,7 +1113,7 @@ var mailToDirector = from x in Funs.DB.Sys_User join y in Funs.DB.Base_Depart on x.DepartId equals y.DepartId where departCode.Contains(y.DepartCode) && x.RoleId == Const.Role_DirectorId select x; - if (DateTime.Now.Day == 11 && mailToDirector.Count() > 0) + if (DateTime.Now.Day == 10 && mailToDirector.Count() > 0) { var mailccLs = new List(); // 部门经理 @@ -1168,7 +1179,7 @@ join y in Funs.DB.Base_Depart on x.DepartId equals y.DepartId where departCode.Contains(y.DepartCode) && x.RoleId == Const.Role_DirectorId select x; - if (DateTime.Now.Day == 11 && mailToDirector.Count() > 0) + if (DateTime.Now.Day == 10 && mailToDirector.Count() > 0) { var mailccLs = new List(); // 部门经理 @@ -1193,6 +1204,7 @@ } } } + #endregion #region 自动填写评价 /// @@ -1436,7 +1448,7 @@ catch (Exception ex) { ErrLogInfo.WriteLog($"执行当前sql:{strSql}错误:{ex.Message},当前ID={d.ID},当前status={status}"); - //记录日志到数据中。 + //记录日志到数据中。 } } } @@ -1738,6 +1750,85 @@ } #endregion + # region 承包商报告主协调员提交后通知承包商联系人,若无异议或3天未操作,发送邮件给用户部门经理 + /// + /// 承包商报告主协调员提交后通知承包商联系人,若无异议或3天未操作,发送邮件给用户部门经理 + /// + /// + /// + private void PunTimer_PunishmentTimer(object sender, System.Timers.ElapsedEventArgs e) + { + var punishments = (from x in Funs.DB.EMC_Punishment + where x.Flag == "2" && x.States == "3" && x.SeType == "1" + && (x.Pause == false || x.Pause == null) && x.MainCoordinatorEndDate.Value.AddDays(3) < DateTime.Now + orderby x.CreateDate descending + select x).ToList(); + if (punishments.Count() > 0) + { + foreach (var pun in punishments) + { + //新增用户部门操作流程 + Model.EMC_PunishmentAudit newAudit = new EMC_PunishmentAudit(); + newAudit.AuditId = SQLHelper.GetNewID(typeof(Model.EMC_PunishmentAudit)); + newAudit.PunishmentId = pun.PunishmentId; + newAudit.AuditMan = pun.UserDep; + BLL.PunishmentAuditService.AddPunishmentAudit(newAudit); + + List userList = new List(); + 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 departLeader = string.Empty; + + var emailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("主协调员填写完成后审批通过通知")); + if (emailTemplate.Count() > 0) + { + var depart = BLL.DepartService.GetDepartById(pun.UserDep); + if (depart != null) + { + departLeader = depart.DepartLeader; + } + if (!string.IsNullOrEmpty(departLeader)) + { + var userTo = from x in Funs.DB.Sys_User + where x.UserId.Contains(departLeader) && 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 == pun.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(); + myPram.Add("发现日期", pun.PunishDate != null ? pun.PunishDate.Value.ToString("yyyy-MM-dd") : ""); + myPram.Add("位置", pun.Location); + myPram.Add("质量事件描述", pun.Description); + MailHelper.SendPunishSesMail(pops, myPram, "主协调员填写完成后审批通过通知", mailTo, mailCC, out resultMessage); + } + } + } + } + } + #endregion + private void Sync_HR(object sender, System.Timers.ElapsedEventArgs e) { //调用接口 diff --git a/FCL/Model/Model.cs b/FCL/Model/Model.cs index c3980f3..70eea38 100644 --- a/FCL/Model/Model.cs +++ b/FCL/Model/Model.cs @@ -9930,6 +9930,16 @@ namespace Model private System.Nullable _UserDepEndDate; + private System.Nullable _Pause; + + private System.Nullable _PauseDate; + + private string _ModifyContent; + + private string _Modifyer; + + private System.Nullable _ModifyDate; + private EntityRef _Base_Depart; private EntityRef _Sys_User; @@ -10056,6 +10066,16 @@ namespace Model partial void OnUserDepStartDateChanged(); partial void OnUserDepEndDateChanging(System.Nullable value); partial void OnUserDepEndDateChanged(); + partial void OnPauseChanging(System.Nullable value); + partial void OnPauseChanged(); + partial void OnPauseDateChanging(System.Nullable value); + partial void OnPauseDateChanged(); + partial void OnModifyContentChanging(string value); + partial void OnModifyContentChanged(); + partial void OnModifyerChanging(string value); + partial void OnModifyerChanged(); + partial void OnModifyDateChanging(System.Nullable value); + partial void OnModifyDateChanged(); #endregion public EMC_Punishment() @@ -11234,6 +11254,106 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Pause", DbType="Bit")] + public System.Nullable Pause + { + get + { + return this._Pause; + } + set + { + if ((this._Pause != value)) + { + this.OnPauseChanging(value); + this.SendPropertyChanging(); + this._Pause = value; + this.SendPropertyChanged("Pause"); + this.OnPauseChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PauseDate", DbType="DateTime")] + public System.Nullable PauseDate + { + get + { + return this._PauseDate; + } + set + { + if ((this._PauseDate != value)) + { + this.OnPauseDateChanging(value); + this.SendPropertyChanging(); + this._PauseDate = value; + this.SendPropertyChanged("PauseDate"); + this.OnPauseDateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ModifyContent", DbType="NVarChar(2000)")] + public string ModifyContent + { + get + { + return this._ModifyContent; + } + set + { + if ((this._ModifyContent != value)) + { + this.OnModifyContentChanging(value); + this.SendPropertyChanging(); + this._ModifyContent = value; + this.SendPropertyChanged("ModifyContent"); + this.OnModifyContentChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Modifyer", DbType="NVarChar(50)")] + public string Modifyer + { + get + { + return this._Modifyer; + } + set + { + if ((this._Modifyer != value)) + { + this.OnModifyerChanging(value); + this.SendPropertyChanging(); + this._Modifyer = value; + this.SendPropertyChanged("Modifyer"); + this.OnModifyerChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ModifyDate", DbType="DateTime")] + public System.Nullable ModifyDate + { + get + { + return this._ModifyDate; + } + set + { + if ((this._ModifyDate != value)) + { + this.OnModifyDateChanging(value); + this.SendPropertyChanging(); + this._ModifyDate = value; + this.SendPropertyChanged("ModifyDate"); + this.OnModifyDateChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EMC_Punishment_Base_Depart", Storage="_Base_Depart", ThisKey="BYC_RU", OtherKey="DepartId", IsForeignKey=true)] public Base_Depart Base_Depart { @@ -38597,7 +38717,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserName", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserName", DbType="NVarChar(60)")] public string UserName { get