11
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using BLL;
|
||||
using BLL.Common;
|
||||
using Model;
|
||||
|
||||
namespace FineUIPro.Web.SES
|
||||
{
|
||||
@@ -17,6 +21,11 @@ namespace FineUIPro.Web.SES
|
||||
{
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
string view = Request.Params["view"];
|
||||
string audit = Request.Params["audit"];
|
||||
if (!string.IsNullOrEmpty(audit))
|
||||
{
|
||||
GPAudit.Hidden = false;
|
||||
}
|
||||
if (view == "1")
|
||||
{
|
||||
this.btnSave.Hidden = true;
|
||||
@@ -42,30 +51,28 @@ namespace FineUIPro.Web.SES
|
||||
txtCompletionDate.Enabled = false;
|
||||
}
|
||||
|
||||
BLL.ViolationClauseService.InitViolationClause(this.drpViolationClause, true);//违章条款
|
||||
//BLL.SESRelatedDataService.InitFONoDropDownList(this.drpFO_No, true);//合同号
|
||||
BLL.ContractorService.InitDropDownList(drpContractor, true); //承包商;
|
||||
//BLL.ContractorService.InitDropDownList(drpContractor, true); //承包商;
|
||||
BLL.DepartService.InitDropDownList(this.drpBYC_RU, true);//BYC负责部门
|
||||
BLL.Sys_UserService.InitUserDropDownList(this.drpViolationInspector, true);//违章检查人
|
||||
|
||||
//BLL.Sys_UserService.InitUserDropDownList(this.drpBYC_Person, true);//
|
||||
BLL.Sys_UserService.InitUserDropDownList(this.drpRequisitioner, true);//合同请购人
|
||||
|
||||
string punishmentId = Request.Params["punishmentId"];
|
||||
if (!string.IsNullOrEmpty(punishmentId))
|
||||
{
|
||||
Model.View_EMC_Punishment punishment = BLL.PunishmentService.GetPunishmentViewById(punishmentId);
|
||||
Model.View_EMC_Que_Punishment punishment = BLL.PunishmentService.GetQuePunishmentViewById(punishmentId);
|
||||
Model.EMC_Punishment pun = BLL.PunishmentService.GetPunishmentById(punishmentId);
|
||||
if (punishment != null)
|
||||
if (punishment != null && pun!=null)
|
||||
{
|
||||
this.txtPunishDate.Text = punishment.PunishDate != null ? string.Format("{0:yyyy-MM-dd}", punishment.PunishDate) : "";
|
||||
this.txtPunishTime.Text = punishment.PunishDate != null ? punishment.PunishDate.Value.ToShortTimeString() : "";
|
||||
this.txtFO_No.Text = punishment.FO_NO;
|
||||
txtItemNo.Text = pun.ItemNo;
|
||||
txtContractor.Text = punishment.Contractor;
|
||||
txtDiscispline.Text = punishment.Discipline;
|
||||
|
||||
if (!string.IsNullOrEmpty(punishment.ContractorId))
|
||||
{
|
||||
this.drpContractor.SelectedValue = punishment.ContractorId;
|
||||
BLL.SESRelatedDataService.InitFONoDropDownList(this.drpFO_No, drpContractor.SelectedValue, true);//合同号
|
||||
this.drpFO_No.SelectedValue = punishment.FO_NO;
|
||||
}
|
||||
|
||||
this.txtDiscispline.Text = punishment.Discipline;
|
||||
this.txtLocation.Text = punishment.Location;
|
||||
this.txtDescription.Text = punishment.Description;
|
||||
|
||||
@@ -73,7 +80,7 @@ namespace FineUIPro.Web.SES
|
||||
this.txtIndividual.Text = punishment.Individual.HasValue ? punishment.Individual.ToString() : "";
|
||||
this.txtBackcharge.Text = punishment.Backcharge.HasValue ? punishment.Backcharge.Value.ToString("0.00") : "";
|
||||
|
||||
if (pun != null && !string.IsNullOrEmpty(pun.ViolationDegree))
|
||||
if (!string.IsNullOrEmpty(pun.ViolationDegree))
|
||||
{
|
||||
drpViolationDegree.SelectedValue = pun.ViolationDegree;
|
||||
}
|
||||
@@ -93,14 +100,78 @@ namespace FineUIPro.Web.SES
|
||||
string depName = BLL.DepartService.GetDepartNameById(user.DepartId);
|
||||
txtInspectionDep.Text = depName;
|
||||
}
|
||||
|
||||
|
||||
if (pun.IsFrame == true)
|
||||
{
|
||||
rbIsFrame.SelectedValue = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
rbIsFrame.SelectedValue = "0";
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(pun.ViolationClauseId))
|
||||
{
|
||||
drpViolationClause.SelectedValue = pun.ViolationClauseId;
|
||||
}
|
||||
txtViolationPerson.Text = pun.ViolationPerson;
|
||||
|
||||
if (!string.IsNullOrEmpty(punishment.Requisitioner))
|
||||
{
|
||||
drpRequisitioner.SelectedValue = punishment.Requisitioner;
|
||||
}
|
||||
|
||||
if (pun.IsFrame == true && (this.CurrUser.DepartId == punishment.BYC_RU || this.CurrUser.Account == Const.Gly))
|
||||
{
|
||||
GPDep.Hidden= false;
|
||||
}
|
||||
else
|
||||
{
|
||||
GPDep.Hidden = true;
|
||||
}
|
||||
|
||||
this.txtCompletionDate.Text = punishment.CompletionDate != null ? string.Format("{0:yyyy-MM-dd}", punishment.CompletionDate) : "";
|
||||
this.txtSESNo.Text = punishment.SES_No;
|
||||
txtViolationRelatedSes.Text = punishment.ViolationRelatedSes;
|
||||
txtViolationRelatedSes1.Text = punishment.ViolationRelatedSes;
|
||||
hdId.Text = punishmentId;
|
||||
|
||||
// 审核
|
||||
if (pun.IsPass != null)
|
||||
{
|
||||
if (pun.IsPass == true)
|
||||
{
|
||||
rbIsPass.SelectedValue = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
rbIsPass.SelectedValue = "0";
|
||||
}
|
||||
}
|
||||
txtAuditResult.Text = pun.AuditResult;
|
||||
|
||||
if (punishment.IsFrame == true)
|
||||
{
|
||||
txtDiscispline.Readonly = true;
|
||||
drpRequisitioner.Hidden = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtDiscispline.Readonly = false;
|
||||
txtContractAdmin.Hidden = true;
|
||||
txtMainCoordinator.Hidden = true;
|
||||
txtUserRepresentative.Hidden = true;
|
||||
txtMCDept.Hidden = true;
|
||||
drpBYC_RU.Hidden = true;
|
||||
GPRole.Hidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
this.drpViolationInspector.SelectedValue = CurrUser.UserId;
|
||||
string depName = BLL.DepartService.GetDepartNameById(CurrUser.DepartId);
|
||||
txtInspectionDep.Text = depName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,19 +186,9 @@ namespace FineUIPro.Web.SES
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
string punishmentId = Request.Params["punishmentId"];
|
||||
string audit = Request.Params["audit"];
|
||||
Model.EMC_Punishment punishment = new Model.EMC_Punishment();
|
||||
|
||||
if (this.drpContractor.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("Please select Contractor!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.drpFO_No.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("Please select Contract No.!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (punishmentId == null)
|
||||
{
|
||||
punishmentId = string.Empty;
|
||||
@@ -138,12 +199,19 @@ namespace FineUIPro.Web.SES
|
||||
return;
|
||||
}
|
||||
|
||||
if (drpViolationClause.SelectedValue == Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("Please select Violation Clause!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
punishment.PunishDate = Funs.GetNewDateTime(this.txtPunishDate.Text.Trim() + " " + txtPunishTime.Text.Trim());
|
||||
punishment.FO_NO = drpFO_No.SelectedValue;
|
||||
punishment.FO_NO = txtFO_No.Text.Trim(); //drpFO_No.SelectedValue;
|
||||
if (txtSESNo.Text.Trim() != string.Empty)
|
||||
{
|
||||
punishment.SES_No = txtSESNo.Text.Trim();
|
||||
}
|
||||
punishment.ItemNo = txtItemNo.Text.Trim();
|
||||
punishment.Location = txtLocation.Text.Trim();
|
||||
punishment.Description = txtDescription.Text.Trim();
|
||||
if (txtCompany.Text != string.Empty)
|
||||
@@ -166,60 +234,486 @@ namespace FineUIPro.Web.SES
|
||||
punishment.CompletionDate = Funs.GetNewDateTime(this.txtCompletionDate.Text.Trim());
|
||||
punishment.Flag = "2";
|
||||
|
||||
if (!string.IsNullOrEmpty(punishmentId))
|
||||
punishment.Contractor=txtContractor.Text.Trim();
|
||||
punishment.Discipline=txtDiscispline.Text.Trim();
|
||||
punishment.ViolationClauseId = drpViolationClause.SelectedValue;
|
||||
if (rbIsFrame.SelectedValue == "1")
|
||||
{
|
||||
punishment.PunishmentId = punishmentId;
|
||||
BLL.PunishmentService.UpdatePunishment(punishment);
|
||||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Modify Contractor Quality Punishment!");
|
||||
ShowNotify("Save successfully!", MessageBoxIcon.Success);
|
||||
punishment.IsFrame = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
punishment.PunishmentId = SQLHelper.GetNewID(typeof(Model.EMC_Punishment));
|
||||
BLL.PunishmentService.AddPunishment(punishment);
|
||||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Add Contractor Quality Punishment!");
|
||||
punishment.IsFrame=false;
|
||||
}
|
||||
punishment.ViolationPerson=txtViolationPerson.Text.Trim();
|
||||
|
||||
if (drpRequisitioner.SelectedValue != Const._Null)
|
||||
{
|
||||
punishment.Requisitioner = drpRequisitioner.SelectedValue;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(txtViolationRelatedSes1.Text))
|
||||
{
|
||||
punishment.ViolationRelatedSes = txtViolationRelatedSes1.Text.Trim();
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(txtViolationRelatedSes.Text))
|
||||
{
|
||||
punishment.ViolationRelatedSes = txtViolationRelatedSes.Text.Trim();
|
||||
}
|
||||
// 保存
|
||||
if (string.IsNullOrEmpty(audit))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(punishmentId))
|
||||
{
|
||||
punishment.PunishmentId = punishmentId;
|
||||
var att = from x in Funs.DB.AttachFile where x.ToKeyId == punishmentId select x;
|
||||
if (att.Count() > 0)
|
||||
{
|
||||
punishment.AttachUrl = att.First().AttachUrl;
|
||||
}
|
||||
BLL.PunishmentService.UpdatePunishment(punishment);
|
||||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Modify Contractor Quality Punishment!");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdId.Text))
|
||||
{
|
||||
punishment.PunishmentId = this.hdId.Text.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
punishment.PunishmentId = SQLHelper.GetNewID(typeof(Model.EMC_Punishment));
|
||||
this.hdId.Text = punishment.PunishmentId;
|
||||
}
|
||||
var att = from x in Funs.DB.AttachFile where x.ToKeyId == punishment.PunishmentId select x;
|
||||
if (att.Count() > 0)
|
||||
{
|
||||
punishment.AttachUrl = att.First().AttachUrl;
|
||||
}
|
||||
punishment.CreateDate = DateTime.Now;
|
||||
BLL.PunishmentService.AddPunishment(punishment);
|
||||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Add Contractor Quality Punishment!");
|
||||
}
|
||||
|
||||
#region 发邮件给审核人通知审核
|
||||
var pun = BLL.PunishmentService.GetPunishmentById(punishment.PunishmentId);
|
||||
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 = mainCoordinator;
|
||||
}
|
||||
}
|
||||
else // 当前用户是主调协员
|
||||
{
|
||||
// 该主调协员不是部门领导时发邮件
|
||||
if (curUser != leader)
|
||||
{
|
||||
auditMan = leader;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 非框架合同
|
||||
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 = requisitioner;
|
||||
}
|
||||
}
|
||||
else // 当前用户是请购人
|
||||
{
|
||||
if (curUser != leader)
|
||||
{
|
||||
auditMan = leader;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pun.EmailIsSend == null || pun.EmailIsSend == false)
|
||||
{
|
||||
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 == auditMan
|
||||
&& x.Email != null && x.Email != ""
|
||||
select x;
|
||||
if (userTo != null)
|
||||
{
|
||||
mailTo = userTo.Select(x => x.Email).ToArray();
|
||||
}
|
||||
|
||||
if (mailTo.Length > 0)
|
||||
{
|
||||
NameValueCollection myPram = new NameValueCollection();
|
||||
myPram.Add("ContractNo", pun.FO_NO);
|
||||
myPram.Add("Contractor", txtContractor.Text);
|
||||
myPram.Add("编号", pun.FO_NO + "-" + pun.ItemNo);
|
||||
myPram.Add("Date", pun.PunishDate != null ? pun.PunishDate.Value.ToString("yyyy-MM-dd") : "");
|
||||
myPram.Add("Time", pun.PunishDate != null ? pun.PunishDate.Value.ToString("HH:mm") : "");
|
||||
myPram.Add("Violation Description", pun.Description);
|
||||
bool result = MailHelper.SendPunishSesMail(pops, myPram, "承包商质量违规审核通知", mailTo, mailCC, out resultMessage);
|
||||
|
||||
if (result)
|
||||
{
|
||||
pun.EmailIsSend = true;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
ShowNotify("Save successfully!", MessageBoxIcon.Success);
|
||||
}
|
||||
// 审核
|
||||
else
|
||||
{
|
||||
var pun = BLL.PunishmentService.GetPunishmentById(punishmentId);
|
||||
if (pun.AuditEmailIsSend == null || pun.AuditEmailIsSend == false)
|
||||
{
|
||||
// 发起人即违章检查人
|
||||
string createMan = pun.Violation_Inspector;
|
||||
string auditMan = Request.Params["auditMan"];
|
||||
pun.AuditMan = auditMan;
|
||||
pun.IsAudit = true;
|
||||
if (rbIsPass.SelectedValue == "1")
|
||||
{
|
||||
pun.IsPass = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
pun.IsPass = false;
|
||||
}
|
||||
|
||||
pun.AuditResult = txtAuditResult.Text.Trim();
|
||||
|
||||
// 发邮件
|
||||
#region 发邮件给发起人通知审核结果
|
||||
if (rbIsPass.SelectedValue != null)
|
||||
{
|
||||
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 = "";
|
||||
bool result = false;
|
||||
|
||||
// 承包商质量违规审核通过
|
||||
if (rbIsPass.SelectedValue == "1")
|
||||
{
|
||||
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 == createMan || x.Account == "suny2")
|
||||
&& x.Email != null && x.Email != ""
|
||||
select x;
|
||||
if (userTo != null)
|
||||
{
|
||||
mailTo = userTo.Select(x => x.Email).ToArray();
|
||||
}
|
||||
|
||||
if (mailTo.Length > 0)
|
||||
{
|
||||
NameValueCollection myPram = new NameValueCollection();
|
||||
myPram.Add("ContractNo", pun.FO_NO);
|
||||
myPram.Add("Contractor", txtContractor.Text);
|
||||
myPram.Add("编号", pun.FO_NO + "-" + pun.ItemNo);
|
||||
myPram.Add("Date", pun.PunishDate != null ? pun.PunishDate.Value.ToString("yyyy-MM-dd") : "");
|
||||
myPram.Add("Time", pun.PunishDate != null ? pun.PunishDate.Value.ToString("HH:mm") : "");
|
||||
myPram.Add("Violation Description", pun.Description);
|
||||
result = MailHelper.SendPunishSesMail(pops, myPram, "承包商质量违规审核通过", mailTo, mailCC, out resultMessage);
|
||||
|
||||
}
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
pun.AuditEmailIsSend = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 承包商质量违规审核被拒绝
|
||||
else
|
||||
{
|
||||
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 == createMan
|
||||
&& x.Email != null && x.Email != ""
|
||||
select x;
|
||||
if (userTo != null)
|
||||
{
|
||||
mailTo = userTo.Select(x => x.Email).ToArray();
|
||||
}
|
||||
|
||||
if (mailTo.Length > 0)
|
||||
{
|
||||
NameValueCollection myPram = new NameValueCollection();
|
||||
myPram.Add("ContractNo", pun.FO_NO);
|
||||
myPram.Add("Contractor", txtContractor.Text);
|
||||
myPram.Add("编号", pun.FO_NO + "-" + pun.ItemNo);
|
||||
myPram.Add("Date", pun.PunishDate != null ? pun.PunishDate.Value.ToString("yyyy-MM-dd") : "");
|
||||
myPram.Add("Time", pun.PunishDate != null ? pun.PunishDate.Value.ToString("HH:mm") : "");
|
||||
myPram.Add("Violation Description", pun.Description);
|
||||
myPram.Add("拒绝描述", txtAuditResult.Text.Trim());
|
||||
result = MailHelper.SendPunishSesMail(pops, myPram, "承包商质量违规审核被拒绝", mailTo, mailCC, out resultMessage);
|
||||
}
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
pun.AuditEmailIsSend = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 当ViolationRelatedSes为空时发送邮件提醒BYC Resp. Dept的部门经理
|
||||
if (rbIsPass.SelectedValue == "1")
|
||||
{
|
||||
var vses = (from x in Funs.DB.EMC_Punishment
|
||||
where x.PunishmentId == punishmentId
|
||||
&& x.IsFrame == true
|
||||
&& x.BYC_RU != null && x.BYC_RU.ToUpper() != "NA"
|
||||
&& (x.ViolationRelatedSes == "" || x.ViolationRelatedSes == null)
|
||||
//x.Flag == "2"
|
||||
//&& (x.RelatedSesMailIsSend == null || x.RelatedSesMailIsSend == false)
|
||||
select x).ToList();
|
||||
if (vses.Count() > 0)
|
||||
{
|
||||
Model.EmailPop pops = Funs.DB.EmailPop.FirstOrDefault(x => x.EmailID == BLL.Const.EmailPopId);
|
||||
if (pops == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var ses in vses)
|
||||
{
|
||||
string[] mailTo = null;
|
||||
string[] mailCC = null;
|
||||
string resultMessage = "";
|
||||
|
||||
var emailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("承包商质量违规关联SES号的填写通知"));
|
||||
if (emailTemplate.Count() > 0)
|
||||
{
|
||||
var dep = BLL.DepartService.GetDepartById(ses.BYC_RU);
|
||||
if (dep != null && !string.IsNullOrEmpty(dep.DepartLeader))
|
||||
{
|
||||
var userTo = from x in Funs.DB.Sys_User
|
||||
where x.UserId == dep.DepartLeader
|
||||
&& x.Email != null && x.Email != ""
|
||||
select x;
|
||||
if (userTo != null)
|
||||
{
|
||||
mailTo = userTo.Select(x => x.Email).ToArray();
|
||||
}
|
||||
|
||||
if (mailTo.Length > 0)
|
||||
{
|
||||
NameValueCollection myPram = new NameValueCollection();
|
||||
myPram.Add("ContractNo", ses.FO_NO);
|
||||
myPram.Add("Contractor", ses.Contractor);
|
||||
myPram.Add("Date", ses.PunishDate != null ? ses.PunishDate.Value.ToString("yyyy-MM-dd") : "");
|
||||
myPram.Add("Time", ses.PunishDate != null ? ses.PunishDate.Value.ToString("HH:mm") : "");
|
||||
myPram.Add("Violation Description", ses.Description);
|
||||
bool result = MailHelper.SendPunishSesMail(pops, myPram, "承包商质量违规关联SES号的填写通知", mailTo, mailCC, out resultMessage);
|
||||
|
||||
if (result)
|
||||
{
|
||||
ses.RelatedSesMailIsSend = true;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void drpContractor_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpContractor.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
this.drpFO_No.Items.Clear();
|
||||
BLL.SESRelatedDataService.InitFONoDropDownList(this.drpFO_No, drpContractor.SelectedValue, true);//合同号
|
||||
drpFO_No.SelectedValue = BLL.Const._Null;
|
||||
txtDiscispline.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
protected void drpFO_No_SelectedIndexChanged(object sender, EventArgs e)
|
||||
protected void txtText_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (drpFO_No.SelectedValue != Const._Null)
|
||||
if (!string.IsNullOrEmpty(txtFO_No.Text))
|
||||
{
|
||||
string foNO = drpFO_No.SelectedValue;
|
||||
string foNO = txtFO_No.Text.Trim();
|
||||
Model.View_FC_SESRelatedData fc = BLL.SESRelatedDataService.GetSESRelatedDataViewByFO(foNO);
|
||||
if (fc != null)
|
||||
{
|
||||
{
|
||||
txtContractor.Text = fc.Contractor;
|
||||
txtDiscispline.Text = fc.Discipline;
|
||||
txtContractAdmin.Text = fc.Contract_Admin;
|
||||
txtMainCoordinator.Text = fc.Main_Coordinator;
|
||||
txtUserRepresentative.Text = fc.User_Representative;
|
||||
txtMCDept.Text = fc.MCDept;
|
||||
|
||||
txtContractAdmin.Hidden = false;
|
||||
txtMainCoordinator.Hidden = false;
|
||||
txtUserRepresentative.Hidden = false;
|
||||
txtMCDept.Hidden = false;
|
||||
drpBYC_RU.Hidden = false;
|
||||
GPRole.Hidden = false;
|
||||
drpRequisitioner.Hidden = true;
|
||||
txtViolationRelatedSes.Hidden = false;
|
||||
GPDep.Hidden = false;
|
||||
|
||||
txtDiscispline.Readonly = true;
|
||||
drpRequisitioner.Required= false;
|
||||
drpRequisitioner.ShowRedStar = false;
|
||||
rbIsFrame.SelectedValue = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
txtDiscispline.Text = string.Empty;
|
||||
txtContractor.Text = string.Empty;
|
||||
txtContractAdmin.Text = string.Empty;
|
||||
txtMainCoordinator.Text = string.Empty;
|
||||
txtUserRepresentative.Text = string.Empty;
|
||||
txtMCDept.Text = string.Empty;
|
||||
|
||||
txtDiscispline.Readonly = false;
|
||||
txtContractAdmin.Hidden = true;
|
||||
txtMainCoordinator.Hidden = true;
|
||||
txtUserRepresentative.Hidden = true;
|
||||
txtMCDept.Hidden = true;
|
||||
drpBYC_RU.Hidden = true;
|
||||
GPRole.Hidden = true;
|
||||
rbIsFrame.SelectedValue = "0";
|
||||
drpRequisitioner.Required = true;
|
||||
drpRequisitioner.ShowRedStar = true;
|
||||
txtViolationRelatedSes.Hidden = true;
|
||||
GPDep.Hidden = true;
|
||||
}
|
||||
|
||||
// 序号
|
||||
var pun=from x in Funs.DB.EMC_Punishment where x.FO_NO== foNO && x.Flag=="2" select x;
|
||||
if (pun.Count() == 0)
|
||||
{
|
||||
txtItemNo.Text = "001";
|
||||
}
|
||||
else
|
||||
{
|
||||
var max = pun.Max(x=>x.ItemNo);
|
||||
if (!string.IsNullOrEmpty(max))
|
||||
{
|
||||
int maxNo = Convert.ToInt32(max) + 1;
|
||||
txtItemNo.Text = "00" + maxNo.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
txtItemNo.Text = "001";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void drpViolationInspector_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
||||
//protected void drpViolationInspector_SelectedIndexChanged(object sender, EventArgs e)
|
||||
//{
|
||||
// if (drpViolationInspector.SelectedValue != Const._Null)
|
||||
// {
|
||||
// string manId = drpViolationInspector.SelectedValue;
|
||||
// var user = BLL.Sys_UserService.GetUsersByUserId(manId);
|
||||
// string depName = BLL.DepartService.GetDepartNameById(user.DepartId);
|
||||
// txtInspectionDep.Text = depName;
|
||||
// }
|
||||
//}
|
||||
|
||||
protected void drpViolationClause_OnSelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (drpViolationInspector.SelectedValue != Const._Null)
|
||||
{
|
||||
string manId = drpViolationInspector.SelectedValue;
|
||||
var user = BLL.Sys_UserService.GetUsersByUserId(manId);
|
||||
string depName = BLL.DepartService.GetDepartNameById(user.DepartId);
|
||||
txtInspectionDep.Text = depName;
|
||||
if (drpViolationClause.SelectedValue != Const._Null)
|
||||
{
|
||||
var vio=BLL.ViolationClauseService.GetViolationClause(drpViolationClause.SelectedValue);
|
||||
if (vio.DeductionComPany1 != 0)
|
||||
{
|
||||
drpViolationDegree.SelectedValue = "1";
|
||||
txtCompany.Text = vio.DeductionComPany1.ToString();
|
||||
txtIndividual.Text = vio.DeductionIndividual1.ToString();
|
||||
txtBackcharge.Text = (vio.DeductionComPany1 + vio.DeductionIndividual1).ToString();
|
||||
}
|
||||
if (vio.DeductionComPany2 != 0)
|
||||
{
|
||||
drpViolationDegree.SelectedValue = "2";
|
||||
txtCompany.Text = vio.DeductionComPany2.ToString();
|
||||
txtIndividual.Text = vio.DeductionIndividual2.ToString();
|
||||
txtBackcharge.Text = (vio.DeductionComPany2 + vio.DeductionIndividual2).ToString();
|
||||
}
|
||||
if (vio.DeductionComPany3 != 0)
|
||||
{
|
||||
drpViolationDegree.SelectedValue = "3";
|
||||
txtCompany.Text = vio.DeductionComPany3.ToString();
|
||||
txtIndividual.Text = vio.DeductionIndividual3.ToString();
|
||||
txtBackcharge.Text = (vio.DeductionComPany2 + vio.DeductionIndividual3).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,6 +733,23 @@ namespace FineUIPro.Web.SES
|
||||
txtBackcharge.Text = (numCompany + numIndividual).Value.ToString("0.00");
|
||||
}
|
||||
|
||||
|
||||
#region 附件上传
|
||||
/// <summary>
|
||||
/// 附件上传
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnAttach_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录
|
||||
{
|
||||
this.hdId.Text = SQLHelper.GetNewID(typeof(Model.EMC_Punishment));
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader2.aspx?type=0&toKeyId={0}&path=FileUpload/SES/EMC_Punishment&menuId={1}", this.hdId.Text, BLL.Const.CQualityPunishMenuId)));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 权限设置
|
||||
/// <summary>
|
||||
/// 菜单按钮权限
|
||||
|
||||
Reference in New Issue
Block a user