Basf_FCL/FCL/FineUIPro.Web/Evaluation/ContractorEvaluation.aspx.cs

840 lines
42 KiB
C#
Raw Normal View History

2024-05-08 10:17:02 +08:00
using BLL;
using NPOI.XSSF.UserModel;
using NPOI.SS.UserModel;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using Model;
using BLL.Common;
using FineUIPro.Web.common;
namespace FineUIPro.Web.Evaluation
{
public partial class ContractorEvaluation : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetButtonPower();
BindGrid();
}
}
private void BindGrid()
{
string strSql = @"SELECT * from View_Contractor_Evaluation WHERE 1=1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(txtFO_NO.Text.Trim()))
{
strSql += " AND FO_NO LIKE @FO_NO";
listStr.Add(new SqlParameter("@FO_NO", "%" + this.txtFO_NO.Text.Trim() + "%"));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table.DefaultView;
Grid1.DataBind();
}
#region
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
Grid1.SortDirection = e.SortDirection;
Grid1.SortField = e.SortField;
BindGrid();
}
#endregion
protected void Grid1_RowSelect(object sender, GridRowSelectEventArgs e)
{
if (!string.IsNullOrEmpty(Grid1.SelectedRowID))
{
GetButtonPower();
var depart = BLL.DepartService.GetDepartById(CurrUser.DepartId);
string rowId = this.Grid1.SelectedRowID;
var sESRelatedData = BLL.SESRelatedDataService.GetSESRelatedDataById(rowId);
if (sESRelatedData != null)
{
if (CurrUser.UserId == Const.GlyId || CurrUser.UserId == sESRelatedData.Main_Coordinator || CurrUser.UserId == sESRelatedData.BuyerId || (depart != null && depart.DepartCode.Contains("CT/K")))
{
btnEdit.Hidden = false;
this.Grid1.EnableRowDoubleClickEvent = true;
}
else
{
btnEdit.Hidden = true;
this.Grid1.EnableRowDoubleClickEvent = false;
}
}
}
}
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Text_TextChanged(object sender, EventArgs e)
{
BindGrid();
}
protected void btnSearch_Click(object sender, EventArgs e)
{
BindGrid();
}
#endregion
protected void btnEdit_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string Id = Grid1.SelectedRowID;
var fo = BLL.SESRelatedDataService.GetSESRelatedDataById(Id);
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ContractorEvaluationEdit.aspx?foNo={0}", fo.FO_NO, "编辑 - ")));
}
#region
/// <summary>
/// 过期提醒邮件发送
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSendEmail_Click(object sender, EventArgs e)
{
bool IsComplite = false;
string errorMsg = string.Empty;
string compMsg = string.Empty;
// 过期提示,30天范围
var foList = from x in Funs.DB.FC_SESRelatedData
where x.Expire_Date != null
2024-06-04 14:03:46 +08:00
&& x.Expire_Date.Value.AddMonths(-6).AddDays(-7).Date <= DateTime.Now.Date
2024-05-08 10:17:02 +08:00
&& x.Expire_Date.Value.Date >= DateTime.Now.Date
select x;
if (foList.Count() > 0)
{
foreach (var fo in foList)
{
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 mailBody = string.Empty;
string mailAttch = string.Empty;
string mailCode = string.Empty;
string mailPriority = string.Empty;
string[] mailCC = null;
string resultMessage = "";
string departId = string.Empty;
var discipline = BLL.DisciplineService.GetDisciplineById(fo.DisciplineId);
//string disc = discipline.Discipline;
//if (!string.IsNullOrEmpty(discipline.DisciplineCN))
//{
// disc = disc + " " + discipline.DisciplineCN;
//}
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)
{
userList.Add(contractAdmin.First());
}
var buyer = from x in Funs.DB.Sys_User where x.UserName == fo.Buyer && x.Email != null && x.Email != "" select x;
if (buyer.Count() > 0)
{
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)
{
userList.Add(mainCoor.First());
}
var userRepresentative = from x in Funs.DB.Sys_User where x.UserId == fo.User_Representative && x.Email != null && x.Email != "" select x;
if (userRepresentative.Count() > 0)
{
userList.Add(userRepresentative.First());
}
2024-05-16 10:17:34 +08:00
// CT/K部门去掉
//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 != ""
// select x;
//if (ctk.Count() > 0)
//{
// foreach (var c in ctk)
// {
// userList.Add(c);
// }
//}
2024-05-08 10:17:02 +08:00
var ctss = from x in Funs.DB.Sys_User
join y in Funs.DB.Sys_Role on x.RoleId equals y.RoleId
where y.RoleName == "CTS/S" && x.Email != null && x.Email != ""
select x;
if (ctss.Count() > 0)
{
foreach (var c in ctss)
{
userList.Add(c);
}
}
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;
mailTo = userList.Select(x => x.Email).Distinct().ToArray();
mailCC = cc.Select(x => x.Email).ToArray();
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)
{
var emailurl = email.Select(p => p.EmailURL).ToList();
mailTo = mailTo.Where(p => !emailurl.Contains(p)).ToArray();
}
//if (mailTo == null || mailTo.Length == 0) return;
if (mailTo != null && mailTo.Length > 0)
{
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();
mailBody = TemplateHelper.BulidByFile2(templetpath, myCol);
IsComplite = MailHelper.SendNetMail1(pops, pops.EmailYx, mailTo, fo.FO_NO + "-" + discipline.Discipline.Replace("\r\n", "") + " 框架合同评估表填写通知", mailBody, mailAttch, mailCode, mailPriority, mailCC, null, out resultMessage);
if (IsComplite)
{
compMsg = compMsg + "合同:" + fo.FO_NO + ",专业:" + discipline.Discipline.Replace("\r\n", "") + ",框架合同评估表填写通知邮件发送成功!";
}
else
{
errorMsg = errorMsg + "合同:" + fo.FO_NO + ",专业:" + discipline.Discipline.Replace("\r\n", "") + ",框架合同评估表填写通知邮件发送失败!";
}
}
}
}
if (compMsg == string.Empty && errorMsg == string.Empty)
{
Alert.ShowInParent("框架合同评估表填写通知邮件已发送!");
}
else
{
Alert.ShowInParent(compMsg + errorMsg);
}
}
else
{
Alert.ShowInParent("无框架合同评估表填写通知邮件需发送!");
return;
}
}
#endregion
#region
/// <summary>
/// 关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, EventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 导出按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnExport_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
//模板文件
string TempletFileName = rootPath + "承包商评估表.xlsx";
//导出文件
string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
string ReportFileName = filePath + "out.xlsx";
FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
#region FC_List
XSSFSheet reportModel = (XSSFSheet)hssfworkbook.GetSheet("Sheet1");
IDataFormat dataformat = hssfworkbook.CreateDataFormat();
ICellStyle styleQfw = hssfworkbook.CreateCellStyle();
styleQfw.DataFormat = dataformat.GetFormat("#,##0.00");
ICellStyle styleTime = hssfworkbook.CreateCellStyle();
styleTime.DataFormat = dataformat.GetFormat("yyyy/m/d HH:mm:ss");
XSSFFont content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
content_Font.FontName = "Wingdings 2";//字体
content_Font.FontHeightInPoints = 11; //字体大小
XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
cs_content_Font.FontName = "宋体";//字体
cs_content_Font.FontHeightInPoints = 8; //字体大小
ICellStyle styleDate = hssfworkbook.CreateCellStyle();
styleDate.DataFormat = dataformat.GetFormat("yyyy/m/d");
styleDate.VerticalAlignment= VerticalAlignment.Center;
styleDate.Alignment= HorizontalAlignment.Center;
styleDate.BorderTop = BorderStyle.Thin;
styleDate.BorderRight = BorderStyle.Thin;
styleDate.SetFont(cs_content_Font);
string txtNo = "£";
var eva = Funs.DB.View_Contractor_Evaluation.FirstOrDefault(x => x.ID.ToString() == Grid1.SelectedRowID);
if (eva != null)
{
//4行
if (reportModel.GetRow(3) == null) reportModel.CreateRow(3);
if (reportModel.GetRow(3).GetCell(2) == null) reportModel.GetRow(3).CreateCell(2);
reportModel.GetRow(3).GetCell(2).SetCellValue(eva.Discipline);
//7行
if (reportModel.GetRow(6) == null) reportModel.CreateRow(6);
if (reportModel.GetRow(6).GetCell(2) == null) reportModel.GetRow(6).CreateCell(2);
reportModel.GetRow(6).GetCell(2).SetCellValue(eva.FO_NO);
if (reportModel.GetRow(6).GetCell(6) == null) reportModel.GetRow(6).CreateCell(6);
if (eva.Validate_Date.HasValue)
{
reportModel.GetRow(6).GetCell(6).SetCellValue(eva.Validate_Date.Value.ToString("yyyy/MM/dd"));
//reportModel.GetRow(6).GetCell(6).CellStyle = styleDate;
}
if (reportModel.GetRow(6).GetCell(8) == null) reportModel.GetRow(6).CreateCell(8);
if (eva.Expire_Date.HasValue)
{
reportModel.GetRow(6).GetCell(8).SetCellValue(eva.Expire_Date.Value.ToString("yyyy/MM/dd"));
//reportModel.GetRow(6).GetCell(8).CellStyle = styleDate;
}
//8行
if (reportModel.GetRow(7) == null) reportModel.CreateRow(7);
if (reportModel.GetRow(7).GetCell(2) == null) reportModel.GetRow(7).CreateCell(2);
reportModel.GetRow(7).GetCell(2).SetCellValue(eva.Contractor);
if (reportModel.GetRow(7).GetCell(8) == null) reportModel.GetRow(7).CreateCell(8);
reportModel.GetRow(7).GetCell(8).SetCellValue(eva.VolumeAllocation);
//9行
if (reportModel.GetRow(8) == null) reportModel.CreateRow(8);
if (reportModel.GetRow(8).GetCell(2) == null) reportModel.GetRow(8).CreateCell(2);
reportModel.GetRow(8).GetCell(2).SetCellValue(eva.Spending_commitment != null ? eva.Spending_commitment.ToString() : "");
if (reportModel.GetRow(8).GetCell(4) == null) reportModel.GetRow(8).CreateCell(4);
reportModel.GetRow(8).GetCell(4).SetCellValue(eva.Forecasted != null ? eva.Forecasted.ToString() : "");
if (reportModel.GetRow(8).GetCell(6) == null) reportModel.GetRow(8).CreateCell(6);
reportModel.GetRow(8).GetCell(6).SetCellValue(eva.Total != null ? eva.Total.ToString() : "");
if (reportModel.GetRow(8).GetCell(8) == null) reportModel.GetRow(8).CreateCell(8);
reportModel.GetRow(8).GetCell(8).SetCellValue(eva.YearAvg != null ? eva.YearAvg.ToString() : "");
// 左边列表
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", eva.FO_NO));
SqlParameter[] yearToDateParList = yearToDateParam.ToArray();
var sesDataTable = SQLHelper.GetDataTableRunProc("Sp_ContractorEvaluation", yearToDateParList);
var sesDataScore = JsonConvert.DeserializeObject<List<YearToDateModel>>(JsonConvert.SerializeObject(sesDataTable));
// 14行
if (reportModel.GetRow(13) == null) reportModel.CreateRow(13);
if (reportModel.GetRow(14) == null) reportModel.CreateRow(14);
if (reportModel.GetRow(15) == null) reportModel.CreateRow(15);
if (reportModel.GetRow(16) == null) reportModel.CreateRow(16);
if (reportModel.GetRow(17) == null) reportModel.CreateRow(17);
if (reportModel.GetRow(18) == null) reportModel.CreateRow(18);
if (reportModel.GetRow(19) == null) reportModel.CreateRow(19);
if (reportModel.GetRow(20) == null) reportModel.CreateRow(20);
if (reportModel.GetRow(21) == null) reportModel.CreateRow(21);
if (reportModel.GetRow(22) == null) reportModel.CreateRow(22);
if (reportModel.GetRow(23) == null) reportModel.CreateRow(23);
if (reportModel.GetRow(24) == null) reportModel.CreateRow(24);
for (int j = 0; j < 24; j++)
{
var curDate = DateTime.Parse("" + startDate.Year + "-" + startDate.Month + "-01").AddMonths(j);
if (j >= 0 && j < 12)
{
if (reportModel.GetRow(13 + j).GetCell(0) == null) reportModel.GetRow(13 + j).CreateCell(0);
reportModel.GetRow(13 + j).GetCell(0).SetCellValue(curDate.ToString("yyyy-MM"));
if (sesDataScore.Count(p => p.dataMonth == curDate.ToString("yyyy-MM")) > 0 && Funs.GetNewDecimal(sesDataScore.FirstOrDefault(p => p.dataMonth == curDate.ToString("yyyy-MM")).SumScore) > 0)
{
var yearNums = float.Parse(sesDataScore.FirstOrDefault(p => p.dataMonth == curDate.ToString("yyyy-MM")).SumScore).ToString("0.##");
reportModel.GetRow(13 + j).GetCell(1).SetCellValue(yearNums);
}
else
{
reportModel.GetRow(13 + j).GetCell(1).SetCellValue("");
}
}
else
{
if (reportModel.GetRow(13 + j - 12).GetCell(2) == null) reportModel.GetRow(13 + j - 12).CreateCell(2);
reportModel.GetRow(13 + j - 12).GetCell(2).SetCellValue(curDate.ToString("yyyy-MM"));
if (sesDataScore.Count(p => p.dataMonth == curDate.ToString("yyyy-MM")) > 0 && Funs.GetNewDecimal(sesDataScore.FirstOrDefault(p => p.dataMonth == curDate.ToString("yyyy-MM")).SumScore) > 0)
{
var yearNums = float.Parse(sesDataScore.FirstOrDefault(p => p.dataMonth == curDate.ToString("yyyy-MM")).SumScore).ToString("0.##");
reportModel.GetRow(13 + j - 12).GetCell(3).SetCellValue(yearNums);
}
else
{
reportModel.GetRow(13 + j - 12).GetCell(3).SetCellValue("");
}
}
}
if (reportModel.GetRow(12).GetCell(5) == null) reportModel.GetRow(12).CreateCell(5);
reportModel.GetRow(12).GetCell(5).SetCellValue(eva.Enumeration);
if (reportModel.GetRow(16).GetCell(6) == null) reportModel.GetRow(16).CreateCell(6);
reportModel.GetRow(16).GetCell(6).SetCellValue(eva.PriceEvaluation1);
if (reportModel.GetRow(17).GetCell(6) == null) reportModel.GetRow(17).CreateCell(6);
reportModel.GetRow(17).GetCell(6).SetCellValue(eva.PriceEvaluation2);
if (reportModel.GetRow(20).GetCell(6) == null) reportModel.GetRow(20).CreateCell(6);
if (reportModel.GetRow(21).GetCell(6) == null) reportModel.GetRow(21).CreateCell(6);
if (reportModel.GetRow(22).GetCell(6) == null) reportModel.GetRow(22).CreateCell(6);
if (reportModel.GetRow(23).GetCell(6) == null) reportModel.GetRow(23).CreateCell(6);
if (reportModel.GetRow(24).GetCell(6) == null) reportModel.GetRow(24).CreateCell(6);
//string priceLevel = string.Empty;
if (eva.PriceLevel == "1")
{
reportModel.GetRow(21).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(21).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(22).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(22).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(23).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(23).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(24).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(24).GetCell(6).CellStyle.SetFont(content_Font);
}
if (eva.PriceLevel == "2")
{
reportModel.GetRow(20).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(20).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(22).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(22).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(23).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(23).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(24).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(24).GetCell(6).CellStyle.SetFont(content_Font);
}
if (eva.PriceLevel == "3")
{
reportModel.GetRow(21).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(21).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(20).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(20).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(23).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(23).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(24).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(24).GetCell(6).CellStyle.SetFont(content_Font);
}
if (eva.PriceLevel == "4")
{
reportModel.GetRow(21).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(21).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(22).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(22).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(20).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(20).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(24).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(24).GetCell(6).CellStyle.SetFont(content_Font);
}
if (eva.PriceLevel == "5")
{
reportModel.GetRow(21).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(21).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(22).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(22).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(23).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(23).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(20).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(20).GetCell(6).CellStyle.SetFont(content_Font);
}
if (string.IsNullOrEmpty(eva.PriceLevel))
{
reportModel.GetRow(20).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(20).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(21).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(21).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(22).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(22).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(23).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(23).GetCell(6).CellStyle.SetFont(content_Font);
reportModel.GetRow(24).GetCell(6).SetCellValue(txtNo);
reportModel.GetRow(24).GetCell(6).CellStyle.SetFont(content_Font);
}
//reportModel.GetRow(20).GetCell(5).SetCellValue(priceLevel);
// 28
if (reportModel.GetRow(28) == null) reportModel.CreateRow(28);
if (reportModel.GetRow(29) == null) reportModel.CreateRow(29);
if (reportModel.GetRow(31) == null) reportModel.CreateRow(31);
if (reportModel.GetRow(32) == null) reportModel.CreateRow(32);
if (reportModel.GetRow(33) == null) reportModel.CreateRow(33);
if (reportModel.GetRow(34) == null) reportModel.CreateRow(34);
if (reportModel.GetRow(35) == null) reportModel.CreateRow(35);
if (reportModel.GetRow(36) == null) reportModel.CreateRow(36);
if (reportModel.GetRow(37) == null) reportModel.CreateRow(37);
if (reportModel.GetRow(38) == null) reportModel.CreateRow(38);
if (reportModel.GetRow(39) == null) reportModel.CreateRow(39);
//if (reportModel.GetRow(40) == null) reportModel.CreateRow(40);
//if (reportModel.GetRow(41) == null) reportModel.CreateRow(41);
//if (reportModel.GetRow(42) == null) reportModel.CreateRow(42);
if (reportModel.GetRow(43) == null) reportModel.CreateRow(43);
if (reportModel.GetRow(44) == null) reportModel.CreateRow(44);
if (reportModel.GetRow(45) == null) reportModel.CreateRow(45);
if (reportModel.GetRow(46) == null) reportModel.CreateRow(46);
if (reportModel.GetRow(47) == null) reportModel.CreateRow(47);
if (reportModel.GetRow(48) == null) reportModel.CreateRow(48);
if (reportModel.GetRow(49) == null) reportModel.CreateRow(49);
if (reportModel.GetRow(50) == null) reportModel.CreateRow(50);
if (reportModel.GetRow(51) == null) reportModel.CreateRow(51);
if (reportModel.GetRow(52) == null) reportModel.CreateRow(52);
if (reportModel.GetRow(53) == null) reportModel.CreateRow(53);
if (reportModel.GetRow(29).GetCell(5) == null) reportModel.GetRow(29).CreateCell(5);
reportModel.GetRow(29).GetCell(5).SetCellValue(eva.ReviewOfFC);
if (eva.IsInquiry == true)
{
reportModel.GetRow(29).GetCell(1).SetCellValue(eva.InquiryNum != null ? eva.InquiryNum.Value.ToString() : "0");
reportModel.GetRow(28).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(28).GetCell(2).CellStyle.SetFont(content_Font);
}
else if (eva.IsInquiry == false)
{
reportModel.GetRow(29).GetCell(1).SetCellValue("");
reportModel.GetRow(28).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(28).GetCell(0).CellStyle.SetFont(content_Font);
}
else
{
reportModel.GetRow(28).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(28).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(28).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(28).GetCell(2).CellStyle.SetFont(content_Font);
}
if (eva.NCRIsReview == true)
{
reportModel.GetRow(33).GetCell(1).SetCellValue(eva.NCRReviewNum != null ? eva.NCRReviewNum.Value.ToString() : "0");
reportModel.GetRow(32).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(32).GetCell(2).CellStyle.SetFont(content_Font);
}
else if (eva.NCRIsReview == false)
{
reportModel.GetRow(33).GetCell(1).SetCellValue("");
reportModel.GetRow(32).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(32).GetCell(0).CellStyle.SetFont(content_Font);
}
else
{
reportModel.GetRow(32).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(32).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(32).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(32).GetCell(2).CellStyle.SetFont(content_Font);
}
//string auditResult = string.Empty;
if (eva.AuditResult == "1")
{
reportModel.GetRow(36).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(36).GetCell(2).CellStyle.SetFont(content_Font);
reportModel.GetRow(37).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(37).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(37).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(37).GetCell(2).CellStyle.SetFont(content_Font);
reportModel.GetRow(38).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(38).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(38).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(38).GetCell(2).CellStyle.SetFont(content_Font);
}
if (eva.AuditResult == "2")
{
reportModel.GetRow(36).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(36).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(37).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(37).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(37).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(37).GetCell(2).CellStyle.SetFont(content_Font);
reportModel.GetRow(38).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(38).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(38).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(38).GetCell(2).CellStyle.SetFont(content_Font);
}
if (eva.AuditResult == "3")
{
reportModel.GetRow(36).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(36).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(36).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(36).GetCell(2).CellStyle.SetFont(content_Font);
reportModel.GetRow(37).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(37).GetCell(2).CellStyle.SetFont(content_Font);
reportModel.GetRow(38).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(38).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(38).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(38).GetCell(2).CellStyle.SetFont(content_Font);
}
if (eva.AuditResult == "4")
{
reportModel.GetRow(36).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(36).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(36).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(36).GetCell(2).CellStyle.SetFont(content_Font);
reportModel.GetRow(37).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(37).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(38).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(38).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(38).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(38).GetCell(2).CellStyle.SetFont(content_Font);
}
if (eva.AuditResult == "5")
{
reportModel.GetRow(36).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(36).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(36).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(36).GetCell(2).CellStyle.SetFont(content_Font);
reportModel.GetRow(37).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(37).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(37).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(37).GetCell(2).CellStyle.SetFont(content_Font);
reportModel.GetRow(38).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(38).GetCell(2).CellStyle.SetFont(content_Font);
}
if (eva.AuditResult == "6")
{
reportModel.GetRow(36).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(36).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(36).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(36).GetCell(2).CellStyle.SetFont(content_Font);
reportModel.GetRow(37).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(37).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(37).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(37).GetCell(2).CellStyle.SetFont(content_Font);
reportModel.GetRow(38).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(38).GetCell(0).CellStyle.SetFont(content_Font);
}
if (string.IsNullOrEmpty(eva.AuditResult))
{
reportModel.GetRow(36).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(36).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(36).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(36).GetCell(2).CellStyle.SetFont(content_Font);
reportModel.GetRow(37).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(37).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(37).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(37).GetCell(2).CellStyle.SetFont(content_Font);
reportModel.GetRow(38).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(38).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(38).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(38).GetCell(2).CellStyle.SetFont(content_Font);
}
// 去年CT/K
//if (eva.BoQIsAudit == true)
//{
// reportModel.GetRow(41).GetCell(0).SetCellValue(txtNo);
// reportModel.GetRow(41).GetCell(0).CellStyle.SetFont(content_Font);
// if (eva.BoQAuditComments.Length > 0 && eva.BoQAuditComments.Length <= 6)
// {
// reportModel.GetRow(41).GetCell(4).SetCellValue(eva.BoQAuditComments);
// }
// if (eva.BoQAuditComments.Length > 6)
// {
// reportModel.GetRow(41).GetCell(4).SetCellValue(eva.BoQAuditComments.Substring(0, 6));
// reportModel.GetRow(42).GetCell(0).SetCellValue(eva.BoQAuditComments.Substring(6, eva.BoQAuditComments.Length - 6));
// }
//}
//else if (eva.BoQIsAudit == false)
//{
// reportModel.GetRow(41).GetCell(2).SetCellValue(txtNo);
// reportModel.GetRow(41).GetCell(2).CellStyle.SetFont(content_Font);
//}
//else
//{
// reportModel.GetRow(41).GetCell(0).SetCellValue(txtNo);
// reportModel.GetRow(41).GetCell(0).CellStyle.SetFont(content_Font);
// reportModel.GetRow(41).GetCell(2).SetCellValue(txtNo);
// reportModel.GetRow(41).GetCell(2).CellStyle.SetFont(content_Font);
//}
if (eva.IsOthers == true)
{
2024-05-16 10:17:34 +08:00
reportModel.GetRow(46).GetCell(1).SetCellValue(eva.OtherDef);
2024-05-08 10:17:02 +08:00
reportModel.GetRow(45).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(45).GetCell(2).CellStyle.SetFont(content_Font);
}
else if (eva.IsOthers == false)
{
reportModel.GetRow(45).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(45).GetCell(0).CellStyle.SetFont(content_Font);
}
else
{
reportModel.GetRow(45).GetCell(0).SetCellValue(txtNo);
reportModel.GetRow(45).GetCell(0).CellStyle.SetFont(content_Font);
reportModel.GetRow(45).GetCell(2).SetCellValue(txtNo);
reportModel.GetRow(45).GetCell(2).CellStyle.SetFont(content_Font);
}
if (reportModel.GetRow(48).GetCell(3) == null) reportModel.GetRow(48).CreateCell(3);
reportModel.GetRow(48).GetCell(3).SetCellValue(eva.TechnicalBonus);
if (reportModel.GetRow(50).GetCell(3) == null) reportModel.GetRow(50).CreateCell(3);
reportModel.GetRow(50).GetCell(3).SetCellValue(eva.SafetyBonus);
reportModel.GetRow(53).GetCell(0).SetCellValue(eva.Proposed);
}
#endregion
reportModel.ForceFormulaRecalculation = true;
using (FileStream filess = File.OpenWrite(ReportFileName))
{
hssfworkbook.Write(filess);
}
FileInfo filet = new FileInfo(ReportFileName);
Response.Clear();
Response.Charset = "GB2312";
Response.ContentEncoding = System.Text.Encoding.UTF8;
// 添加头信息,为"文件下载/另存为"对话框指定默认文件名
Response.AddHeader("Content-Disposition", "attachment; filename=承包商评估表_" + Server.UrlEncode(DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"));
// 添加头信息,指定文件大小,让浏览器能够显示下载进度
Response.AddHeader("Content-Length", filet.Length.ToString());
// 指定返回的是一个不能被客户端读取的流,必须被下载
Response.ContentType = "application/ms-excel";
// 把文件流发送到客户端
Response.WriteFile(filet.FullName);
// 停止页面的执行
Response.End();
}
#endregion
/// <summary>
/// Grid行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnEdit_Click(null, null);
}
#region
/// <summary>
/// 实体
/// </summary>
public class YearToDateModel
{
public string FO_NO { get; set; } = string.Empty;
public string dataMonth { get; set; } = string.Empty;
public string SumScore { get; set; } = string.Empty;
}
#endregion
#region
/// <summary>
/// 菜单按钮权限
/// </summary>
private void GetButtonPower()
{
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.UserId, BLL.Const.ContractorEvaluationMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnOut))
{
this.btnExport.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnSend))
{
this.btnSendEmail.Hidden = false;
}
}
}
#endregion
}
}