This commit is contained in:
2024-06-18 10:34:42 +08:00
parent 3d69c04346
commit 20904bda17
11 changed files with 465 additions and 219 deletions
@@ -1,15 +1,19 @@
using BLL;
using BLL.Common;
using FineUIPro.Web.common.SysManage;
using Model;
using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using static NPOI.POIFS.Crypt.CryptoFunctions;
namespace FineUIPro.Web.Evaluation
{
@@ -247,10 +251,15 @@ namespace FineUIPro.Web.Evaluation
HiddenField hidisDepScore4 = Grid1.Rows[i].FindControl("hidisDepScore4") as HiddenField;
HiddenField hidisDepScore5 = Grid1.Rows[i].FindControl("hidisDepScore5") as HiddenField;
HiddenField hidisDepScore6 = Grid1.Rows[i].FindControl("hidisDepScore6") as HiddenField;
HiddenField hidMaxScore1 = Grid1.Rows[i].FindControl("hidMaxScore1") as HiddenField;
HiddenField hidMaxScore2 = Grid1.Rows[i].FindControl("hidMaxScore2") as HiddenField;
HiddenField hidMsg = Grid1.Rows[i].FindControl("hidMsg") as HiddenField;
var foNo = Grid1.Rows[i].DataKeys[0].ToString();
var isEvaluateType = Grid1.Rows[i].DataKeys[1].ToString();
var evaluateType = Grid1.Rows[i].DataKeys[2].ToString();
var userType = Grid1.Rows[i].DataKeys[3].ToString();
if (contractorList != null && contractorList.Count(p => p.FO_NO == foNo) > 0)
{
@@ -260,6 +269,63 @@ namespace FineUIPro.Web.Evaluation
lblContractor.Text = contractModel.Contractor;
}
}
// 违章扣分
if (userType == "1")
{
var sesList = Funs.DB.FC_SESReportView.Where(p => p.FO_NO == foNo && p.Requisitioner == CurrUser.Account).OrderByDescending(t => t.ViolationDegree).FirstOrDefault();
switch (sesList?.ViolationDegree)
{
case "1":
hidMaxScore1.Text = "4.5";
hidMsg.Text = $"当前合同号:{foNo}下,SES:{sesList?.SES_No}存在一般违章,";
break;
case "2":
hidMaxScore1.Text = "4";
hidMsg.Text = $"当前合同号:{foNo}下,SES:{sesList?.SES_No}存在严重违章,";
break;
case "3":
hidMaxScore1.Text = "3.5";
hidMsg.Text = $"当前合同号:{foNo}下,SES:{sesList?.SES_No}存在零容忍违章,";
break;
default:
hidMaxScore1.Text = "5";
hidMsg.Text = "";
break;
}
}
else
{
var sesList = Funs.DB.FC_SESReportView.AsQueryable();
var setList = Funs.DB.Sys_User.Where(p => new string[] { Const.Role_CTSSId, Const.Role_CTSCId, Const.Role_CTMTId }.Contains(p.RoleId) && p.UserId == CurrUser.UserId).ToList();
if (setList.Count > 0)
sesList = sesList.Where(p => p.FO_NO == foNo && p.Requisitioner != "" && p.Requisitioner != null && p.Requisitioner != string.Empty).OrderByDescending(t => t.ViolationDegree);
else
sesList = sesList.Where(p => p.FO_NO == foNo && (p.MainCoordinatorUser == CurrUser.Account || p.ContractAdminUser == CurrUser.Account || p.UserRepresentativeUser == CurrUser.Account)).OrderByDescending(t => t.ViolationDegree);
var max = sesList.FirstOrDefault();
switch (max?.ViolationDegree)
{
case "1":
hidMaxScore2.Text = "4.5";
hidMsg.Text = $"当前合同号:{foNo}下,SES:{max?.SES_No}存在一般违章,";
break;
case "2":
hidMaxScore2.Text = "4";
hidMsg.Text = $"当前合同号:{foNo}下,SES:{max?.SES_No}存在严重违章,";
break;
case "3":
hidMaxScore2.Text = "3.5";
hidMsg.Text = $"当前合同号:{foNo}下,SES:{max?.SES_No}存在零容忍违章,";
break;
default:
hidMaxScore2.Text = "5";
hidMsg.Text = "";
break;
}
}
if (isEvaluateType == "1")
{
Grid1.Rows[i].RowCssClass = "color1";
@@ -758,6 +824,21 @@ namespace FineUIPro.Web.Evaluation
}
Funs.DB.Score_JournalEvaluation.InsertAllOnSubmit(scoreJournalList);
}
// 回写违章捐款(用户)
var PunishList = from x in pjSESReport where x.ViolationDegree != null select x;
if (PunishList.Count() > 0)
{
foreach (var p in PunishList)
{
var punish = Funs.DB.EMC_Punishment.FirstOrDefault(x => x.FO_NO == p.FO_NO && x.ViolationRelatedSes == p.SES_No);
if (punish != null)
{
punish.IsUserEvaluated = true;
Funs.DB.SubmitChanges();
}
}
}
}
//部门
if (item.EvaluateType == "Dep")
@@ -872,6 +953,21 @@ namespace FineUIPro.Web.Evaluation
}
Funs.DB.Score_JournalEvaluation.InsertAllOnSubmit(scoreJournalList);
}
// 回写违章捐款(部门)
var PunishList = from x in pjSESReport where x.ViolationDegree != null select x;
if (PunishList.Count() > 0)
{
foreach (var p in PunishList)
{
var punish = Funs.DB.EMC_Punishment.FirstOrDefault(x => x.FO_NO == p.FO_NO && x.ViolationRelatedSes == p.SES_No);
if (punish != null)
{
punish.IsDepEvaluated = true;
Funs.DB.SubmitChanges();
}
}
}
}
}
}
@@ -908,7 +1004,7 @@ namespace FineUIPro.Web.Evaluation
{
sesList = Funs.DB.FC_SESReportView.Where(p => p.FO_NO == FoNo && p.Requisitioner == CurrUser.Account).ToList();
}
Grid2.DataSource = sesList;
Grid2.DataSource = sesList.OrderByDescending(x => x.ShowViolationDegree);
Grid2.DataBind();
}
#endregion
@@ -1357,5 +1453,38 @@ namespace FineUIPro.Web.Evaluation
BindGrid();
}
#endregion
protected void Grid2_RowDataBound(object sender, GridRowEventArgs e)
{
var row = e.DataItem as Model.FC_SESReportView;
if (!string.IsNullOrEmpty(row.ShowViolationDegree))
{
e.RowCssClass = "color2";
}
}
protected string ConvertViolationDegree(object violationDegree)
{
string degree = string.Empty;
if (violationDegree != null)
{
if (violationDegree.ToString() == "1")
{
degree = "一般违章";
}
if (violationDegree.ToString() == "2")
{
degree = "严重违章";
}
if (violationDegree.ToString() == "3")
{
degree = "零容忍违章";
}
}
return degree;
}
}
}