2022-09-05 16:36:31 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.OfficeCheck.Check
|
|
|
|
|
|
{
|
2023-06-27 15:37:37 +08:00
|
|
|
|
public partial class CheckContentEdit : PageBase
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
|
|
|
|
|
#region 定义项
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 主键
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string CheckNoticeId
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return (string)ViewState["CheckNoticeId"];
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewState["CheckNoticeId"] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 加载
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.GetButtonPower();
|
|
|
|
|
|
BLL.ProjectService.InitAllProjectDropDownList(this.drpSubjectProject, true);
|
|
|
|
|
|
string type = Request.Params["type"];//查看
|
|
|
|
|
|
if (type == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnSave.Hidden = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.CheckNoticeId = Request.Params["CheckNoticeId"];
|
|
|
|
|
|
if (!string.IsNullOrEmpty(this.CheckNoticeId))
|
|
|
|
|
|
{
|
2023-06-27 15:37:37 +08:00
|
|
|
|
var checkInfo = BLL.CheckNoticeService.GetCheckNoticeById(this.CheckNoticeId);
|
|
|
|
|
|
if (checkInfo != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.drpSubjectProject.SelectedValue = checkInfo.SubjectProjectId;
|
2023-07-10 18:10:50 +08:00
|
|
|
|
this.txtCheckLeader.Text = Person_PersonsService.GetPersonsNameById(checkInfo.CheckTeamLeader);
|
2025-10-10 14:33:21 +08:00
|
|
|
|
this.txtSubjectUnitMan.Text = Person_PersonsService.GetPersonsNameById(checkInfo.SubjectUnitMan);
|
2023-06-27 15:37:37 +08:00
|
|
|
|
}
|
2023-07-10 18:10:50 +08:00
|
|
|
|
this.txtCheckMan.Text = this.CurrUser.PersonName;
|
|
|
|
|
|
this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|
|
|
|
|
this.txtSubjectUnitDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
2023-06-27 15:37:37 +08:00
|
|
|
|
|
2023-07-10 18:10:50 +08:00
|
|
|
|
var table1 = BLL.CheckTable1Service.GetCheckTable1ByCheckNoticeId(this.CheckNoticeId);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
if (table1 != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!string.IsNullOrEmpty(table1.SubjectProjectId))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.drpSubjectProject.SelectedValue = table1.SubjectProjectId;
|
|
|
|
|
|
}
|
2023-07-10 18:10:50 +08:00
|
|
|
|
this.txtCheckMan.Text = table1.CheckMan;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
this.txtCheckLeader.Text = table1.CheckLeader;
|
|
|
|
|
|
this.txtSubjectUnitMan.Text = table1.SubjectUnitMan;
|
|
|
|
|
|
this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", table1.CheckDate);
|
|
|
|
|
|
this.txtSubjectUnitDate.Text = string.Format("{0:yyyy-MM-dd}", table1.SubjectUnitDate);
|
2023-07-10 18:10:50 +08:00
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
if (table1.Total100Score.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.lbTotal100Score.Text = "本表百分制得分 = (实查项实得分之和/实查项应得满分之和*100) " + table1.Total100Score + " 分";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.lbTotal100Score.Text = "本表百分制得分 = (实查项实得分之和/实查项应得满分之和*100) 分";
|
|
|
|
|
|
}
|
2023-11-14 16:02:36 +08:00
|
|
|
|
if (table1.Total100Score.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.lbTotalCheckScore.Text = table1.Total100Score.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.lbTotalCheckScore.Text = "100";
|
|
|
|
|
|
}
|
2023-07-10 18:10:50 +08:00
|
|
|
|
//if (table1.TotalLastScore.HasValue)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// this.lbTotalLastScore.Text = "综合评定得分 = 本表得分 - 负面清单罚分 = " + table1.TotalLastScore + " 分";
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else
|
|
|
|
|
|
//{
|
|
|
|
|
|
// this.lbTotalLastScore.Text = "综合评定得分 = 本表得分 - 负面清单罚分 = 分";
|
|
|
|
|
|
//}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
|
|
|
|
|
|
this.lbEvaluationResult.Text = table1.EvaluationResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 数据绑定
|
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
|
{
|
2023-11-14 16:02:36 +08:00
|
|
|
|
string strSql = @"SELECT CheckNoticeId,ID,SortIndex,CheckItem,CheckStandard,CheckMethod,CheckResult,BaseScore,DeletScore,GetScore,Type,IsSelect
|
|
|
|
|
|
FROM ProjectSupervision_Check1
|
|
|
|
|
|
WHERE Type='1' AND CheckNoticeId=@CheckNoticeId ORDER BY SortIndex";
|
2022-09-05 16:36:31 +08:00
|
|
|
|
SqlParameter[] parameter = new SqlParameter[]
|
|
|
|
|
|
{
|
|
|
|
|
|
new SqlParameter("@CheckNoticeId",this.CheckNoticeId),
|
|
|
|
|
|
};
|
|
|
|
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
|
this.Grid1.DataSource = tb;
|
|
|
|
|
|
//求和
|
|
|
|
|
|
this.OutputSummaryData(tb);
|
|
|
|
|
|
this.Grid1.DataBind();
|
|
|
|
|
|
}
|
2023-07-10 18:10:50 +08:00
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 合计值
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="source"></param>
|
|
|
|
|
|
private void OutputSummaryData(DataTable source)
|
|
|
|
|
|
{
|
|
|
|
|
|
decimal baseScoreTotal = 0;
|
|
|
|
|
|
decimal deletScoreTotal = 0;
|
|
|
|
|
|
decimal getScoreTotal = 0;
|
|
|
|
|
|
foreach (DataRow row in source.Rows)
|
|
|
|
|
|
{
|
2023-11-14 16:02:36 +08:00
|
|
|
|
if (row["IsSelect"].ToString() == "True")
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2023-11-14 16:02:36 +08:00
|
|
|
|
baseScoreTotal += Funs.GetNewDecimalOrZero(row["BaseScore"].ToString());
|
|
|
|
|
|
deletScoreTotal += Funs.GetNewDecimalOrZero(row["DeletScore"].ToString());
|
|
|
|
|
|
getScoreTotal += Funs.GetNewDecimalOrZero(row["GetScore"].ToString());
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
JObject summary = new JObject();
|
|
|
|
|
|
summary.Add("CheckItem", "合计分");
|
|
|
|
|
|
summary.Add("BaseScore", baseScoreTotal);
|
|
|
|
|
|
summary.Add("DeletScore", deletScoreTotal);
|
|
|
|
|
|
summary.Add("GetScore", getScoreTotal);
|
|
|
|
|
|
this.Grid1.SummaryData = summary;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 排序
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 保存按钮事件
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 保存按钮事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (this.drpSubjectProject.SelectedValue == BLL.Const._Null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请选择项目名称!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.Grid1.GetModifiedData().Count > 0)
|
|
|
|
|
|
{
|
2023-11-14 16:02:36 +08:00
|
|
|
|
//BLL.ProjectSupervision_Check1Service.DeleteCheckByNoticeId(this.CheckNoticeId);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
JArray teamGroupData = this.Grid1.GetMergedData();
|
|
|
|
|
|
foreach (JObject teamGroupRow in teamGroupData)
|
|
|
|
|
|
{
|
2023-11-14 16:02:36 +08:00
|
|
|
|
JObject values = teamGroupRow.Value<JObject>("values"); bool isSelect = Convert.ToBoolean(values.Value<string>("IsSelect"));
|
|
|
|
|
|
if (isSelect)
|
2025-10-10 14:33:21 +08:00
|
|
|
|
{
|
2023-11-14 16:02:36 +08:00
|
|
|
|
var taleItem = Funs.DB.ProjectSupervision_Check1.FirstOrDefault(x => x.ID == values.Value<string>("ID"));
|
|
|
|
|
|
if (taleItem != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
taleItem.CheckResult = values.Value<string>("CheckResult");
|
|
|
|
|
|
taleItem.IsSelect = Convert.ToBoolean(values.Value<string>("IsSelect"));
|
|
|
|
|
|
taleItem.BaseScore = Funs.GetNewDecimalOrZero(values.Value<string>("BaseScore"));
|
|
|
|
|
|
taleItem.DeletScore = Funs.GetNewDecimalOrZero(values.Value<string>("DeletScore"));
|
|
|
|
|
|
taleItem.GetScore = (taleItem.BaseScore - taleItem.DeletScore);
|
|
|
|
|
|
Funs.DB.SubmitChanges();
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
decimal totalBaseScore = 0; ///总基准分
|
|
|
|
|
|
decimal totalDeletScore = 0; ///总扣减分
|
|
|
|
|
|
decimal totalGetScore = 0; ///总得分
|
|
|
|
|
|
decimal total100Score = 0; ///换算100分制
|
|
|
|
|
|
decimal totalLastScore = 0; ///综合得分
|
|
|
|
|
|
var tale1Item = from x in Funs.DB.ProjectSupervision_Check1 where x.CheckNoticeId == this.CheckNoticeId && x.Type == "1" orderby x.SortIndex select x;
|
|
|
|
|
|
if (tale1Item.Count() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item in tale1Item)
|
|
|
|
|
|
{
|
2023-11-14 16:02:36 +08:00
|
|
|
|
if (item.IsSelect == true)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
|
|
|
|
|
totalBaseScore += item.BaseScore.Value;
|
|
|
|
|
|
totalDeletScore += item.DeletScore.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (totalBaseScore > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
totalGetScore = totalBaseScore - totalDeletScore;
|
|
|
|
|
|
decimal sS = (totalGetScore / totalBaseScore) * 100;
|
|
|
|
|
|
total100Score = Math.Round(sS, 2);
|
2023-11-14 16:02:36 +08:00
|
|
|
|
totalLastScore = total100Score;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BLL.CheckTable1Service.DeleteCheckTable1ByNoticeId(this.CheckNoticeId);
|
|
|
|
|
|
Model.ProjectSupervision_CheckTable1 table1 = new Model.ProjectSupervision_CheckTable1();
|
|
|
|
|
|
if (this.drpSubjectProject.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpSubjectProject.SelectedValue))
|
|
|
|
|
|
{
|
|
|
|
|
|
table1.SubjectProjectId = this.drpSubjectProject.SelectedValue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
table1.CheckMan = this.txtCheckMan.Text.Trim();
|
|
|
|
|
|
table1.CheckLeader = this.txtCheckLeader.Text.Trim();
|
|
|
|
|
|
table1.CheckDate = Funs.GetNewDateTime(this.txtCheckDate.Text);
|
|
|
|
|
|
table1.SubjectUnitMan = this.txtSubjectUnitMan.Text.Trim();
|
|
|
|
|
|
table1.SubjectUnitDate = Funs.GetNewDateTime(this.txtSubjectUnitDate.Text);
|
|
|
|
|
|
table1.TotalBaseScore = totalBaseScore;
|
|
|
|
|
|
table1.TotalDeletScore = totalDeletScore;
|
|
|
|
|
|
table1.TotalGetScore = totalGetScore;
|
|
|
|
|
|
table1.Total100Score = total100Score;
|
|
|
|
|
|
table1.TotalLastScore = totalLastScore;
|
|
|
|
|
|
table1.EvaluationResult = Funs.ReturnEvaluationResultByScore(table1.TotalLastScore);
|
|
|
|
|
|
table1.CheckNoticeId = this.CheckNoticeId;
|
2023-07-10 18:10:50 +08:00
|
|
|
|
table1.CheckItemId = SQLHelper.GetNewID();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
BLL.CheckTable1Service.AddCheckTable1(table1);
|
|
|
|
|
|
|
|
|
|
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 按钮权限
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
|
{
|
|
|
|
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.CheckNoticeMenuId);
|
|
|
|
|
|
if (buttonList.Count() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnSave.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|