SGGL_SHJ/SGGL/FineUIPro.Web/PZHGL/InformationProject/ProjectConstructionLog.aspx.cs

2610 lines
123 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using BLL;
using Newtonsoft.Json.Linq;
using NPOI.SS.Util;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.PZHGL.InformationProject
{
public partial class ProjectConstructionLog : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
public string ProjectConstructionLogId
{
get
{
return (string)ViewState["ProjectConstructionLogId"];
}
set
{
ViewState["ProjectConstructionLogId"] = value;
}
}
#endregion
/// <summary>
/// 加载表头
/// </summary>
protected void Page_Init(object sender, EventArgs e)
{
InitGrid();
}
#region
/// <summary>
/// 表头
/// </summary>
private void InitGrid()
{
Model.SGGLDB db = Funs.DB;
var projectUsers = from x in db.Person_Persons
join y in db.SitePerson_Person
on x.PersonId equals y.PersonId
where y.RoleIds != null && y.RoleIds != string.Empty && y.ProjectId == this.CurrUser.LoginProjectId
select x;
string workPostId = string.Empty, machineId = string.Empty;
foreach (var projectUser in projectUsers)
{
if (!string.IsNullOrEmpty(projectUser.LogWorkPostId))
{
workPostId += projectUser.LogWorkPostId + ",";
}
if (!string.IsNullOrEmpty(projectUser.LogMachineId))
{
machineId += projectUser.LogMachineId + ",";
}
}
if (!string.IsNullOrEmpty(workPostId))
{
workPostId = workPostId.Substring(0, workPostId.Length - 1);
}
if (!string.IsNullOrEmpty(machineId))
{
machineId = machineId.Substring(0, machineId.Length - 1);
}
this.hdWorkPostId.Text = workPostId;
this.hdMachineId.Text = machineId;
List<string> list = Funs.GetStrListByStr(this.hdWorkPostId.Text, ',');
list = list.Distinct().ToList();
workPostId = Funs.GetStrListByList(list);
this.hdWorkPostId.Text = workPostId;
for (int i = 0; i < list.Count; i++)
{
RenderField rdPlan = new RenderField();
rdPlan.ColumnID = "Num" + i.ToString();
rdPlan.Width = Unit.Pixel(100);
rdPlan.DataField = "Num" + i.ToString();
rdPlan.FieldType = FieldType.Int;
rdPlan.HeaderText = BLL.WorkPostService.getWorkPostNameById(list[i]);
rdPlan.HeaderTextAlign = TextAlign.Center;
//NumberBox numPlan = new NumberBox();
//numPlan.NoNegative = true;
//numPlan.NoDecimal = true;
//rdPlan.Editor.Add(numPlan);
Grid1.Columns.Add(rdPlan);
}
List<string> list2 = Funs.GetStrListByStr(this.hdMachineId.Text, ',');
list2 = list2.Distinct().ToList();
machineId = Funs.GetStrListByList(list2);
this.hdMachineId.Text = machineId;
for (int i = 0; i < list2.Count; i++)
{
RenderField rdPlan = new RenderField();
rdPlan.ColumnID = "Num" + i.ToString();
rdPlan.Width = Unit.Pixel(100);
rdPlan.DataField = "Num" + i.ToString();
rdPlan.FieldType = FieldType.Int;
rdPlan.HeaderText = BLL.SpecialEquipmentService.GetSpecialEquipmentNameById(list2[i]);
rdPlan.HeaderTextAlign = TextAlign.Center;
//NumberBox numPlan = new NumberBox();
//numPlan.NoNegative = true;
//numPlan.NoDecimal = true;
//rdPlan.Editor.Add(numPlan);
Grid2.Columns.Add(rdPlan);
}
}
#endregion
private void OutputSummaryData()
{
List<string> list = Funs.GetStrListByStr(this.hdWorkPostId.Text, ',');
int[] sum1 = new int[list.Count];
foreach (JObject mergedRow in Grid1.GetMergedData())
{
JObject values = mergedRow.Value<JObject>("values");
for (int i = 0; i < list.Count; i++)
{
sum1[i] += Funs.GetNewIntOrZero(values.Value<string>("Num" + i.ToString()));
}
}
JObject summary1 = new JObject();
summary1.Add("UnitWorkName", "合计");
for (int i = 0; i < list.Count; i++)
{
summary1.Add("Num" + i.ToString(), sum1[i]);
}
Grid1.SummaryData = summary1;
List<string> list2 = Funs.GetStrListByStr(this.hdMachineId.Text, ',');
int[] sum2 = new int[list2.Count];
foreach (JObject mergedRow in Grid2.GetMergedData())
{
JObject values = mergedRow.Value<JObject>("values");
for (int i = 0; i < list2.Count; i++)
{
sum2[i] += Funs.GetNewIntOrZero(values.Value<string>("Num" + i.ToString()));
}
}
JObject summary2 = new JObject();
summary2.Add("UnitWorkName", "合计");
for (int i = 0; i < list2.Count; i++)
{
summary2.Add("Num" + i.ToString(), sum2[i]);
}
Grid2.SummaryData = summary2;
decimal sumTodayCompleteSize = 0, sumTotalCompleteSize = 0, sumTotalSize = 0, sumTomorrowPlanSize = 0;
foreach (JObject mergedRow in Grid6.GetMergedData())
{
JObject values = mergedRow.Value<JObject>("values");
sumTodayCompleteSize += Funs.GetNewDecimalOrZero(values.Value<string>("TodayCompleteSize"));
sumTotalCompleteSize += Funs.GetNewDecimalOrZero(values.Value<string>("TotalCompleteSize"));
sumTotalSize += Funs.GetNewDecimalOrZero(values.Value<string>("TotalSize"));
sumTomorrowPlanSize += Funs.GetNewDecimalOrZero(values.Value<string>("TomorrowPlanSize"));
}
string sumRate = "/";
if (sumTotalSize > 0)
{
sumRate = decimal.Round(sumTotalCompleteSize / sumTotalSize * 100, 2) + "%";
}
JObject summary3 = new JObject();
summary3.Add("UnitWorkName", "合计");
summary3.Add("TodayCompleteSize", sumTodayCompleteSize);
summary3.Add("TotalCompleteSize", sumTotalCompleteSize);
summary3.Add("TotalSize", sumTotalSize);
summary3.Add("TotalRate", sumRate);
summary3.Add("TomorrowPlanSize", sumTomorrowPlanSize);
Grid6.SummaryData = summary3;
}
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//var projectUser = SitePerson_PersonService.GetSitePersonByProjectIdIdentityCard(this.CurrUser.LoginProjectId, this.CurrUser.IdentityCard);
//if (projectUser != null && projectUser.WorkPostId == BLL.Const.WorkPost_ConstructionManager)
//{
// this.row1.Hidden = true;
// this.row2.Hidden = true;
// this.row3.Hidden = true;
// this.Grid1.Hidden = true;
// this.Grid2.Hidden = true;
// this.Grid3.Hidden = true;
// this.Grid4.Hidden = true;
//}
//else
//{
// if (string.IsNullOrEmpty(this.hdWorkPostId.Text.Trim()))
// {
// Alert.ShowInTop("请先在个人信息中设置施工日志工种!", MessageBoxIcon.Warning);
// return;
// }
// if (string.IsNullOrEmpty(this.hdMachineId.Text.Trim()))
// {
// Alert.ShowInTop("请先在个人信息中设置施工日志机械!", MessageBoxIcon.Warning);
// return;
// }
// this.Grid5.Hidden = true;
//}
UnitWorkService.InitUnitWorkDownList(drpUnitWork, this.CurrUser.LoginProjectId, true);
this.drpProfessional.DataTextField = "Value";
this.drpProfessional.DataValueField = "Text";
this.drpProfessional.DataSource = BLL.PHTGL_QuantityService.GetMajorItems2();
this.drpProfessional.DataBind();
Funs.FineUIPleaseSelect(this.drpProfessional);
//合同编号
this.drpContractNo.DataTextField = "ContractName";
this.drpContractNo.DataValueField = "ContractId";
this.drpContractNo.DataSource = BLL.PHTGL_ContractReviewService.GetContractReview_CompleteData(this.CurrUser.LoginProjectId);
this.drpContractNo.DataBind();
Funs.FineUIPleaseSelect(this.drpContractNo);
//所属WBS
BLL.WorkPackageInitService.InitDownList(this.drpWorkPackage, false);
this.txtReportDate.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
this.InitTreeMenu();
}
}
#endregion
#region --
/// <summary>
/// 加载树
/// </summary>
private void InitTreeMenu()
{
if (!string.IsNullOrEmpty(this.txtReportDate.Text.Trim()))
{
DateTime? startTime = Funs.GetNewDateTime(this.txtReportDate.Text.Trim());
DateTime? endTime = startTime.HasValue ? startTime.Value.AddMonths(1) : System.DateTime.Now;
this.tvControlItem.Nodes.Clear();
TreeNode rootNode = new TreeNode();
rootNode.Text = "项目施工日志";
rootNode.NodeID = "0";
rootNode.CommandName = "Project";
rootNode.EnableClickEvent = true;
rootNode.Expanded = true;
this.tvControlItem.Nodes.Add(rootNode);
var logs = from x in Funs.DB.ZHGL_ProjectConstructionLog
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileDate >= startTime && x.CompileDate < endTime
select x;
foreach (var item in logs)
{
TreeNode rootUnitNode = new TreeNode();//定义根节点
rootUnitNode.Text = item.FileCode;
rootUnitNode.NodeID = item.ProjectConstructionLogId;
rootUnitNode.CommandName = "Log";
rootUnitNode.Expanded = true;
rootUnitNode.EnableClickEvent = true;
rootUnitNode.ToolTip = "施工日志";
rootNode.Nodes.Add(rootUnitNode);
}
}
else
{
Alert.ShowInTop("请选择月份!", MessageBoxIcon.Warning);
return;
}
}
#endregion
#region Tree
protected void Tree_TextChanged(object sender, EventArgs e)
{
this.InitTreeMenu();
}
#endregion
#region
/// <summary>
/// 点击树节点
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
if (this.tvControlItem.SelectedNode.CommandName == "Project")
{
if (this.GetButtonPower(BLL.Const.BtnAdd))
{
this.btnMenuAdd.Hidden = false;
this.btnMenuEdit.Hidden = true;
this.btnMenuDown.Hidden = true;
this.btnMenuDelete.Hidden = true;
}
}
else
{
if (this.GetButtonPower(BLL.Const.BtnModify))
{
this.btnMenuAdd.Hidden = true;
this.btnMenuEdit.Hidden = false;
this.btnMenuDown.Hidden = false;
this.btnMenuDelete.Hidden = false;
}
}
this.ProjectConstructionLogId = this.tvControlItem.SelectedNodeID;
if (!string.IsNullOrEmpty(this.ProjectConstructionLogId))
{
GetData();
}
else
{
this.ProjectConstructionLogId = string.Empty;
}
}
#endregion
private void GetData()
{
var log = BLL.ProjectConstructionLogService.GetProjectConstructionLogById(ProjectConstructionLogId);
if (log != null)
{
this.txtFileCode.Text = log.FileCode;
if (log.CompileDate != null)
{
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", log.CompileDate.Value);
this.txtWeek.Text = Funs.GetWeekDay(log.CompileDate.Value.DayOfWeek.ToString());
}
this.txtWeather.Text = log.Weather;
this.txtTemperature.Text = log.Temperature;
this.txtCompileMan.Text = BLL.Person_PersonsService.GetPersonsNameById(log.CompileMan);
if (!string.IsNullOrEmpty(log.ContractNo))
{
if (log.ContractNo.Length > 0)
{
this.drpContractNo.SelectedValueArray = log.ContractNo.Split(',');
}
}
drpContractNo_SelectedIndexChanged(null, null);
if (!string.IsNullOrEmpty(log.UnitWorks))
{
if (log.UnitWorks.Length > 0)
{
this.drpUnitWork.SelectedValueArray = log.UnitWorks.Split(',');
}
}
if (!string.IsNullOrEmpty(log.Professional))
{
if (log.Professional.Length > 0)
{
this.drpProfessional.SelectedValueArray = log.Professional.Split(',');
}
}
this.txtRemark.Text = log.Remark;
drpUnitWork_SelectedIndexChanged(null, null);
var personLogs = from x in Funs.DB.ZHGL_ConstructionLog
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileDate == log.CompileDate.Value
orderby x.CompileDate descending
select x;
List<Model.ConstructionLogHSE> hses = new List<Model.ConstructionLogHSE>();
List<Model.ConstructionLogCQMS> cqmss = new List<Model.ConstructionLogCQMS>();
if (personLogs.Count() > 0)
{
foreach (var personLog in personLogs)
{
var projectUser = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(this.CurrUser.LoginProjectId, personLog.CompileMan);
if (projectUser != null)
{
if (projectUser.WorkPostId != BLL.Const.WorkPost_ConstructionManager)
{
if (!string.IsNullOrEmpty(personLog.HSETodaySummary) || !string.IsNullOrEmpty(personLog.HSETodaySummaryRemark) || !string.IsNullOrEmpty(personLog.HSETomorrowPlan) || !string.IsNullOrEmpty(personLog.HSETomorrowPlanRemark))
{
Model.ConstructionLogHSE hse = new Model.ConstructionLogHSE();
hse.ConstructionLogId = personLog.ConstructionLogId;
hse.HSETodaySummary = personLog.HSETodaySummary;
hse.HSETodaySummaryRemark = personLog.HSETodaySummaryRemark;
hse.HSETomorrowPlan = personLog.HSETomorrowPlan;
hse.HSETomorrowPlanRemark = personLog.HSETomorrowPlanRemark;
hses.Add(hse);
}
if (!string.IsNullOrEmpty(personLog.CQMSTodaySummary) || !string.IsNullOrEmpty(personLog.CQMSTodaySummaryRemark) || !string.IsNullOrEmpty(personLog.CQMSTomorrowPlan) || !string.IsNullOrEmpty(personLog.CQMSTomorrowPlanRemark))
{
Model.ConstructionLogCQMS cqms = new Model.ConstructionLogCQMS();
cqms.ConstructionLogId = personLog.ConstructionLogId;
cqms.CQMSTodaySummary = personLog.CQMSTodaySummary;
cqms.CQMSTodaySummaryRemark = personLog.CQMSTodaySummaryRemark;
cqms.CQMSTomorrowPlan = personLog.CQMSTomorrowPlan;
cqms.CQMSTomorrowPlanRemark = personLog.CQMSTomorrowPlanRemark;
cqmss.Add(cqms);
}
}
}
else
{
if (!string.IsNullOrEmpty(personLog.HSETodaySummary) || !string.IsNullOrEmpty(personLog.HSETodaySummaryRemark) || !string.IsNullOrEmpty(personLog.HSETomorrowPlan) || !string.IsNullOrEmpty(personLog.HSETomorrowPlanRemark))
{
Model.ConstructionLogHSE hse = new Model.ConstructionLogHSE();
hse.ConstructionLogId = personLog.ConstructionLogId;
hse.HSETodaySummary = personLog.HSETodaySummary;
hse.HSETodaySummaryRemark = personLog.HSETodaySummaryRemark;
hse.HSETomorrowPlan = personLog.HSETomorrowPlan;
hse.HSETomorrowPlanRemark = personLog.HSETomorrowPlanRemark;
hses.Add(hse);
}
if (!string.IsNullOrEmpty(personLog.CQMSTodaySummary) || !string.IsNullOrEmpty(personLog.CQMSTodaySummaryRemark) || !string.IsNullOrEmpty(personLog.CQMSTomorrowPlan) || !string.IsNullOrEmpty(personLog.CQMSTomorrowPlanRemark))
{
Model.ConstructionLogCQMS cqms = new Model.ConstructionLogCQMS();
cqms.ConstructionLogId = personLog.ConstructionLogId;
cqms.CQMSTodaySummary = personLog.CQMSTodaySummary;
cqms.CQMSTodaySummaryRemark = personLog.CQMSTodaySummaryRemark;
cqms.CQMSTomorrowPlan = personLog.CQMSTomorrowPlan;
cqms.CQMSTomorrowPlanRemark = personLog.CQMSTomorrowPlanRemark;
cqmss.Add(cqms);
}
}
}
this.GridHSETodaySummary.DataSource = hses;
this.GridHSETodaySummary.DataBind();
this.GridHSETomorrowPlan.DataSource = hses;
this.GridHSETomorrowPlan.DataBind();
this.GridCQMSTodaySummary.DataSource = cqmss;
this.GridCQMSTodaySummary.DataBind();
this.GridCQMSTomorrowPlan.DataSource = cqmss;
this.GridCQMSTomorrowPlan.DataBind();
}
ChangeText();
OutputSummaryData();
}
}
#region
/// <summary>
/// 增加按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuAdd_Click(object sender, EventArgs e)
{
if (this.GetButtonPower(BLL.Const.BtnAdd))
{
TextNew();
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
private void TextNew()
{
this.ProjectConstructionLogId = string.Empty;
DateTime today = DateTime.Now.Date;
if (!string.IsNullOrEmpty(this.txtCompileDate.Text.Trim()))
{
today = Convert.ToDateTime(this.txtCompileDate.Text.Trim()).Date;
}
//string prefix = string.Format("{0:yyyyMMdd}", today) + "-";
//this.txtFileCode.Text = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "ZHGL_ProjectConstructionLog", "FileCode", this.CurrUser.LoginProjectId, prefix);
string prefix = string.Format("{0:yyyyMMdd}", today);
this.txtFileCode.Text = prefix;
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", today);
this.txtWeek.Text = Funs.GetWeekDay(today.DayOfWeek.ToString());
this.txtWeather.Text = string.Empty;
this.txtTemperature.Text = string.Empty;
var log = (from x in Funs.DB.ZHGL_ConstructionLog
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileDate == today
select x).FirstOrDefault();
if (log != null)
{
this.txtWeather.Text = log.Weather;
this.txtTemperature.Text = log.Temperature;
}
this.txtCompileMan.Text = this.CurrUser.PersonName;
this.drpContractNo.SelectedIndex = 0;
this.drpUnitWork.SelectedIndex = 0;
this.drpProfessional.SelectedIndex = 0;
var personLogs = from x in Funs.DB.ZHGL_ConstructionLog
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileDate == today
orderby x.CompileDate descending
select x;
List<Model.ConstructionLogHSE> hses = new List<Model.ConstructionLogHSE>();
List<Model.ConstructionLogCQMS> cqmss = new List<Model.ConstructionLogCQMS>();
this.GridHSETodaySummary.DataSource = null;
this.GridHSETodaySummary.DataBind();
this.GridHSETomorrowPlan.DataSource = null;
this.GridHSETomorrowPlan.DataBind();
this.GridCQMSTodaySummary.DataSource = null;
this.GridCQMSTodaySummary.DataBind();
this.GridCQMSTomorrowPlan.DataSource = null;
this.GridCQMSTomorrowPlan.DataBind();
if (personLogs.Count() > 0)
{
string contractNo = string.Empty, unitWorks = string.Empty, professional = string.Empty;
foreach (var personLog in personLogs)
{
if (!string.IsNullOrEmpty(personLog.ContractNo))
{
contractNo += "," + personLog.ContractNo;
}
if (!string.IsNullOrEmpty(personLog.UnitWorks))
{
unitWorks += "," + personLog.UnitWorks;
}
if (!string.IsNullOrEmpty(personLog.Professional))
{
professional += "," + personLog.Professional;
}
if (!string.IsNullOrEmpty(personLog.HSETodaySummary) || !string.IsNullOrEmpty(personLog.HSETodaySummaryRemark) || !string.IsNullOrEmpty(personLog.HSETomorrowPlan) || !string.IsNullOrEmpty(personLog.HSETomorrowPlanRemark))
{
Model.ConstructionLogHSE hse = new Model.ConstructionLogHSE();
hse.ConstructionLogId = personLog.ConstructionLogId;
hse.HSETodaySummary = personLog.HSETodaySummary;
hse.HSETodaySummaryRemark = personLog.HSETodaySummaryRemark;
hse.HSETomorrowPlan = personLog.HSETomorrowPlan;
hse.HSETomorrowPlanRemark = personLog.HSETomorrowPlanRemark;
hses.Add(hse);
}
if (!string.IsNullOrEmpty(personLog.CQMSTodaySummary) || !string.IsNullOrEmpty(personLog.CQMSTodaySummaryRemark) || !string.IsNullOrEmpty(personLog.CQMSTomorrowPlan) || !string.IsNullOrEmpty(personLog.CQMSTomorrowPlanRemark))
{
Model.ConstructionLogCQMS cqms = new Model.ConstructionLogCQMS();
cqms.ConstructionLogId = personLog.ConstructionLogId;
cqms.CQMSTodaySummary = personLog.CQMSTodaySummary;
cqms.CQMSTodaySummaryRemark = personLog.CQMSTodaySummaryRemark;
cqms.CQMSTomorrowPlan = personLog.CQMSTomorrowPlan;
cqms.CQMSTomorrowPlanRemark = personLog.CQMSTomorrowPlanRemark;
cqmss.Add(cqms);
}
}
this.GridHSETodaySummary.DataSource = hses;
this.GridHSETodaySummary.DataBind();
this.GridHSETomorrowPlan.DataSource = hses;
this.GridHSETomorrowPlan.DataBind();
this.GridCQMSTodaySummary.DataSource = cqmss;
this.GridCQMSTodaySummary.DataBind();
this.GridCQMSTomorrowPlan.DataSource = cqmss;
this.GridCQMSTomorrowPlan.DataBind();
if (!string.IsNullOrEmpty(contractNo))
{
if (contractNo.Length > 0)
{
this.drpContractNo.SelectedValueArray = contractNo.Split(',');
}
}
drpContractNo_SelectedIndexChanged(null, null);
if (!string.IsNullOrEmpty(unitWorks))
{
if (unitWorks.Length > 0)
{
this.drpUnitWork.SelectedValueArray = unitWorks.Split(',');
}
}
if (!string.IsNullOrEmpty(professional))
{
if (professional.Length > 0)
{
this.drpProfessional.SelectedValueArray = professional.Split(',');
}
}
}
this.txtRemark.Text = string.Empty;
this.Grid1.DataSource = null;
this.Grid1.DataBind();
this.Grid2.DataSource = null;
this.Grid2.DataBind();
this.Grid3.DataSource = null;
this.Grid3.DataBind();
this.Grid4.DataSource = null;
this.Grid4.DataBind();
this.Grid5.DataSource = null;
this.Grid5.DataBind();
drpUnitWork_SelectedIndexChanged(null, null);
ChangeText();
OutputSummaryData();
}
private void TextEmpty()
{
this.ProjectConstructionLogId = string.Empty;
this.txtFileCode.Text = string.Empty;
this.txtCompileDate.Text = string.Empty;
this.txtWeek.Text = string.Empty;
this.txtWeather.Text = string.Empty;
this.txtTemperature.Text = string.Empty;
this.txtCompileMan.Text = string.Empty;
this.drpContractNo.SelectedIndex = 0;
this.drpUnitWork.SelectedIndex = 0;
this.drpProfessional.SelectedIndex = 0;
this.txtRemark.Text = string.Empty;
this.Grid1.DataSource = null;
this.Grid1.DataBind();
this.Grid2.DataSource = null;
this.Grid2.DataBind();
this.Grid3.DataSource = null;
this.Grid3.DataBind();
this.Grid4.DataSource = null;
this.Grid4.DataBind();
this.Grid5.DataSource = null;
this.Grid5.DataBind();
}
#endregion
#region
/// <summary>
/// 编辑按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click(object sender, EventArgs e)
{
if (this.GetButtonPower(BLL.Const.BtnModify))
{
this.ProjectConstructionLogId = this.tvControlItem.SelectedNodeID;
GetData();
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 导出按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDown_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/");
string initTemplatePath = string.Empty;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
string filePath = string.Empty;
initTemplatePath = Const.ConstructionLogTemplateUrl;
uploadfilepath = rootPath + initTemplatePath;
string constructionLogId = this.tvControlItem.SelectedNodeID;
Model.SGGLDB db = Funs.DB;
Model.ZHGL_ProjectConstructionLog log = BLL.ProjectConstructionLogService.GetProjectConstructionLogById(constructionLogId);
if (log != null)
{
DateTime day = DateTime.Now.Date;
if (log.CompileDate != null)
{
day = log.CompileDate.Value;
}
var personLogs = from x in Funs.DB.ZHGL_ConstructionLog
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileDate == day
orderby x.CompileDate descending
select x;
var personLogIds = (from x in db.ZHGL_ConstructionLog
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileDate == day
orderby x.CompileDate descending
select x.ConstructionLogId).ToList();
var workEfficiencys = from x in Funs.DB.ZHGL_ConstructionLogWorkEfficiency
where personLogIds.Contains(x.ConstructionLogId)
select x;
var persons = from x in db.ZHGL_ConstructionLogPerson
where personLogIds.Contains(x.ConstructionLogId)
select x;
var machines = from x in db.ZHGL_ConstructionLogMachine
where personLogIds.Contains(x.ConstructionLogId)
select x;
var project = BLL.ProjectService.GetProjectByProjectId(log.ProjectId);
var compileMan = BLL.Person_PersonsService.GetPersonsNameById(log.CompileMan);
DateTime date = DateTime.Now;
if (log.CompileDate != null)
{
date = log.CompileDate.Value;
}
newUrl = uploadfilepath.Replace(".xlsx", "(" + compileMan + "_" + string.Format("{0:yyyy-MM-dd}", date) + ")" + ".xlsx");
newUrl = newUrl.Replace("施工日志", "项目施工日志");
File.Copy(uploadfilepath, newUrl);
// 第一步:读取文件流
NPOI.SS.UserModel.IWorkbook workbook;
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
{
workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
}
// 创建单元格样式
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
cellStyle0.WrapText = true;
var font = workbook.CreateFont();
font.FontHeightInPoints = 11;
font.IsBold = false;
cellStyle0.SetFont(font);
NPOI.SS.UserModel.ICellStyle cellStyle2 = workbook.CreateCellStyle();
cellStyle2.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle2.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle2.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle2.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle2.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
cellStyle2.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
cellStyle2.WrapText = true;
var font0 = workbook.CreateFont();
font0.FontHeightInPoints = 13;
font0.IsBold = false;
cellStyle2.SetFont(font0);
NPOI.SS.UserModel.ICellStyle cellStyle3 = workbook.CreateCellStyle();
cellStyle3.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle3.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle3.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle3.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle3.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
cellStyle3.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
cellStyle3.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Grey25Percent.Index;
cellStyle3.FillPattern = NPOI.SS.UserModel.FillPattern.SolidForeground;
cellStyle3.WrapText = true;
var font3 = workbook.CreateFont();
font3.FontHeightInPoints = 11;
font3.IsBold = true;
cellStyle3.SetFont(font3);
// 第二步:创建新数据行
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
NPOI.SS.UserModel.IRow row1 = sheet.GetRow(0);
NPOI.SS.UserModel.ICell cell3;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle2;
cell3.SetCellValue(project.ProjectName + "施工日志");
row1 = sheet.GetRow(1);
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(log.FileCode);
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(project.ProjectAddress);
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(project.ProjectName);
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(compileMan);
row1 = sheet.GetRow(2);
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(project.ProjectRealCode);
row1 = sheet.GetRow(3);
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(string.Format("{0:yyyy-MM-dd}", date));
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(log.Weather);
row1 = sheet.GetRow(4);
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(Funs.GetWeekDay(date.DayOfWeek.ToString()));
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(log.Temperature);
row1 = sheet.GetRow(5);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle3;
cell3.SetCellValue("人工机械消耗数据");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(5, 5, 0, 13));
row1 = sheet.GetRow(6);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("合同名称");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle3;
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle3;
sheet.AddMergedRegion(new CellRangeAddress(6, 6, 0, 2));
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("单位工程");
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle3;
sheet.AddMergedRegion(new CellRangeAddress(6, 6, 3, 5));
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("专业工程");
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle3;
sheet.AddMergedRegion(new CellRangeAddress(6, 6, 6, 8));
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("填报状态");
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("备注");
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(6, 6, 10, 13));
row1 = sheet.GetRow(7);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(BLL.ContractService.GetContractName(log.ContractNo));
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(7, 7, 0, 2));
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(BLL.UnitWorkService.GetUnitWorkName(log.UnitWorks));
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(7, 7, 3, 5));
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(BLL.PHTGL_QuantityService.GetMajorName(log.Professional));
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(7, 7, 6, 8));
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
string workEfficiency = "未填报";
if (workEfficiencys.Count() > 0)
{
workEfficiency = "已填报";
}
cell3.SetCellValue(workEfficiency);
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(log.Remark);
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(7, 7, 10, 13));
row1 = sheet.GetRow(8);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle3;
cell3.SetCellValue("作业人员人数");
row1 = sheet.GetRow(9);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("序号");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("单位工程");
List<string> list = Funs.GetStrListByStr(this.hdWorkPostId.Text, ',');
for (int i = 0; i < list.Count; i++)
{
cell3 = row1.CreateCell(i + 2);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(BLL.WorkPostService.getWorkPostNameById(list[i]));
}
row1 = sheet.GetRow(8);
cell3 = row1.CreateCell(1 + list.Count);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(8, 8, 0, 1 + list.Count));
int rowCount = 10;
int[] sum1 = new int[list.Count];
List<string> unitWorklist = Funs.GetStrListByStr(log.UnitWorks, ',');
for (int i = 0; i < unitWorklist.Count; i++)
{
row1 = sheet.GetRow(rowCount + i);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue((i + 1).ToString());
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(BLL.UnitWorkService.GetUnitWorkName(unitWorklist[i]));
for (int j = 0; j < list.Count; j++)
{
cell3 = row1.CreateCell(j + 2);
cell3.CellStyle = cellStyle0;
int num = 0;
num = persons.Where(x => x.UnitWorkId == unitWorklist[i] && x.WorkPostId == list[j]).ToList().Sum(x => x.Num ?? 0);
cell3.SetCellValue(num.ToString());
sum1[j] += Funs.GetNewIntOrZero(num.ToString());
}
}
rowCount += unitWorklist.Count;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("合计");
for (int i = 0; i < sum1.Length; i++)
{
cell3 = row1.CreateCell(i + 2);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(sum1[i].ToString());
}
rowCount++;
int rowMachineTitle = rowCount;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle3;
cell3.SetCellValue("机械数量");
rowCount++;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("序号");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("单位工程");
List<string> list2 = Funs.GetStrListByStr(this.hdMachineId.Text, ',');
for (int i = 0; i < list2.Count; i++)
{
cell3 = row1.CreateCell(i + 2);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(BLL.SpecialEquipmentService.GetSpecialEquipmentNameById(list2[i]));
}
row1 = sheet.GetRow(rowMachineTitle);
cell3 = row1.CreateCell(1 + list2.Count);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowMachineTitle, rowMachineTitle, 0, 1 + list2.Count));
rowCount++;
int[] sum2 = new int[list2.Count];
for (int i = 0; i < unitWorklist.Count; i++)
{
row1 = sheet.GetRow(rowCount + i);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue((i + 1).ToString());
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(BLL.UnitWorkService.GetUnitWorkName(unitWorklist[i]));
for (int j = 0; j < list2.Count; j++)
{
cell3 = row1.CreateCell(j + 2);
cell3.CellStyle = cellStyle0;
int num = 0;
num = machines.Where(x => x.UnitWorkId == unitWorklist[i] && x.MachineId == list2[j]).ToList().Sum(x => x.Num ?? 0);
cell3.SetCellValue(num.ToString());
sum2[j] += Funs.GetNewIntOrZero(num.ToString());
}
}
rowCount += unitWorklist.Count;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("合计");
for (int i = 0; i < sum2.Length; i++)
{
cell3 = row1.CreateCell(i + 2);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(sum2[i].ToString());
}
rowCount++;
int rowHJGLTitle = rowCount;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle3;
cell3.SetCellValue("焊接数据");
rowCount++;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("序号");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("单位工程");
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("今日完成DIN");
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("累计完成DIN");
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("总量DIN");
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("累计完成百分比");
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("明日计划DIN");
row1 = sheet.GetRow(rowHJGLTitle);
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowHJGLTitle, rowHJGLTitle, 0, 6));
rowCount++;
var hjgls = (from x in db.ZHGL_ConstructionLogHJGL
where personLogIds.Contains(x.ConstructionLogId)
orderby x.UnitWorkId
select x).ToList();
if (hjgls.Count > 0)
{
decimal sumTodayCompleteSize = 0, sumTotalCompleteSize = 0, sumTotalSize = 0, sumTomorrowPlanSize = 0;
for (int i = 0; i < hjgls.Count; i++)
{
row1 = sheet.GetRow(rowCount + i);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue((i + 1).ToString());
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(BLL.UnitWorkService.GetUnitWorkName(hjgls[i].UnitWorkId));
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(hjgls[i].TodayCompleteSize.Value.ToString("0.###"));
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(hjgls[i].TotalCompleteSize.Value.ToString("0.###"));
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(hjgls[i].TotalSize.Value.ToString("0.###"));
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(hjgls[i].TotalRate);
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(hjgls[i].TomorrowPlanSize.Value.ToString("0.###"));
sumTodayCompleteSize += hjgls[i].TodayCompleteSize.Value;
sumTotalCompleteSize += hjgls[i].TotalCompleteSize.Value;
sumTotalSize += hjgls[i].TotalSize.Value;
sumTomorrowPlanSize += hjgls[i].TomorrowPlanSize.Value;
}
rowCount += hjgls.Count;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("合计");
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(sumTodayCompleteSize.ToString("0.###"));
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(sumTotalCompleteSize.ToString("0.###"));
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(sumTotalSize.ToString("0.###"));
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
string sumRate = "/";
if (sumTotalSize > 0)
{
sumRate = decimal.Round(sumTotalCompleteSize / sumTotalSize * 100, 2) + "%";
}
cell3.SetCellValue(sumRate);
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(sumTomorrowPlanSize.ToString("0.###"));
rowCount++;
}
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle3;
cell3.SetCellValue("专业管理");
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 0, 13));
rowCount++;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("序号");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("单位工程");
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("今日完成工作");
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle3;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 2, 6));
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("明日计划工作");
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle3;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 7, 11));
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("填报人");
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle3;
cell3.SetCellValue("备注");
rowCount++;
var managements = (from x in db.ZHGL_ConstructionLogManagement
where personLogIds.Contains(x.ConstructionLogId)
orderby x.UnitWorkId
select x).ToList();
for (int i = 0; i < managements.Count; i++)
{
row1 = sheet.GetRow(rowCount + i);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue((i + 1).ToString());
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(BLL.UnitWorkService.GetUnitWorkName(managements[i].UnitWorkId));
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(managements[i].TodayWork);
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount + i, rowCount + i, 2, 6));
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(managements[i].TomorrowWork);
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount + i, rowCount + i, 7, 11));
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(ConvertCompileManName(managements[i].ConstructionLogId));
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(managements[i].Remark);
}
rowCount += managements.Count;
List<Model.ConstructionLogHSE> hses = new List<Model.ConstructionLogHSE>();
List<Model.ConstructionLogCQMS> cqmss = new List<Model.ConstructionLogCQMS>();
if (personLogs.Count() > 0)
{
foreach (var personLog in personLogs)
{
var projectUser = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(this.CurrUser.LoginProjectId, personLog.CompileMan);
if (projectUser != null)
{
if (projectUser.WorkPostId != BLL.Const.WorkPost_ConstructionManager)
{
if (!string.IsNullOrEmpty(personLog.HSETodaySummary) || !string.IsNullOrEmpty(personLog.HSETodaySummaryRemark) || !string.IsNullOrEmpty(personLog.HSETomorrowPlan) || !string.IsNullOrEmpty(personLog.HSETomorrowPlanRemark))
{
Model.ConstructionLogHSE hse = new Model.ConstructionLogHSE();
hse.ConstructionLogId = personLog.ConstructionLogId;
hse.HSETodaySummary = personLog.HSETodaySummary;
hse.HSETodaySummaryRemark = personLog.HSETodaySummaryRemark;
hse.HSETomorrowPlan = personLog.HSETomorrowPlan;
hse.HSETomorrowPlanRemark = personLog.HSETomorrowPlanRemark;
hses.Add(hse);
}
if (!string.IsNullOrEmpty(personLog.CQMSTodaySummary) || !string.IsNullOrEmpty(personLog.CQMSTodaySummaryRemark) || !string.IsNullOrEmpty(personLog.CQMSTomorrowPlan) || !string.IsNullOrEmpty(personLog.CQMSTomorrowPlanRemark))
{
Model.ConstructionLogCQMS cqms = new Model.ConstructionLogCQMS();
cqms.ConstructionLogId = personLog.ConstructionLogId;
cqms.CQMSTodaySummary = personLog.CQMSTodaySummary;
cqms.CQMSTodaySummaryRemark = personLog.CQMSTodaySummaryRemark;
cqms.CQMSTomorrowPlan = personLog.CQMSTomorrowPlan;
cqms.CQMSTomorrowPlanRemark = personLog.CQMSTomorrowPlanRemark;
cqmss.Add(cqms);
}
}
}
else
{
if (!string.IsNullOrEmpty(personLog.HSETodaySummary) || !string.IsNullOrEmpty(personLog.HSETodaySummaryRemark) || !string.IsNullOrEmpty(personLog.HSETomorrowPlan) || !string.IsNullOrEmpty(personLog.HSETomorrowPlanRemark))
{
Model.ConstructionLogHSE hse = new Model.ConstructionLogHSE();
hse.ConstructionLogId = personLog.ConstructionLogId;
hse.HSETodaySummary = personLog.HSETodaySummary;
hse.HSETodaySummaryRemark = personLog.HSETodaySummaryRemark;
hse.HSETomorrowPlan = personLog.HSETomorrowPlan;
hse.HSETomorrowPlanRemark = personLog.HSETomorrowPlanRemark;
hses.Add(hse);
}
if (!string.IsNullOrEmpty(personLog.CQMSTodaySummary) || !string.IsNullOrEmpty(personLog.CQMSTodaySummaryRemark) || !string.IsNullOrEmpty(personLog.CQMSTomorrowPlan) || !string.IsNullOrEmpty(personLog.CQMSTomorrowPlanRemark))
{
Model.ConstructionLogCQMS cqms = new Model.ConstructionLogCQMS();
cqms.ConstructionLogId = personLog.ConstructionLogId;
cqms.CQMSTodaySummary = personLog.CQMSTodaySummary;
cqms.CQMSTodaySummaryRemark = personLog.CQMSTodaySummaryRemark;
cqms.CQMSTomorrowPlan = personLog.CQMSTomorrowPlan;
cqms.CQMSTomorrowPlanRemark = personLog.CQMSTomorrowPlanRemark;
cqmss.Add(cqms);
}
}
}
}
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle3;
cell3.SetCellValue("安全管理");
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 0, 13));
rowCount++;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("序号");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("当日小结");
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 1, 11));
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("填报人");
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("备注");
rowCount++;
for (int i = 0; i < hses.Count; i++)
{
row1 = sheet.GetRow(rowCount + i);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue((i + 1).ToString());
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(hses[i].HSETodaySummary);
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount + i, rowCount + i, 1, 11));
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(ConvertCompileManName(hses[i].ConstructionLogId));
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(hses[i].HSETodaySummaryRemark);
}
rowCount += hses.Count;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("序号");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("明日计划");
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 1, 11));
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("填报人");
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("备注");
rowCount++;
for (int i = 0; i < hses.Count; i++)
{
row1 = sheet.GetRow(rowCount + i);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue((i + 1).ToString());
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(hses[i].HSETomorrowPlan);
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount + i, rowCount + i, 1, 11));
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(ConvertCompileManName(hses[i].ConstructionLogId));
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(hses[i].HSETomorrowPlanRemark);
}
rowCount += hses.Count;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle3;
cell3.SetCellValue("质量管理");
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 0, 13));
rowCount++;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("序号");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("当日小结");
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 1, 11));
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("填报人");
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("备注");
rowCount++;
for (int i = 0; i < cqmss.Count; i++)
{
row1 = sheet.GetRow(rowCount + i);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue((i + 1).ToString());
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(cqmss[i].CQMSTodaySummary);
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount + i, rowCount + i, 1, 11));
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(ConvertCompileManName(cqmss[i].ConstructionLogId));
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(cqmss[i].CQMSTodaySummaryRemark);
}
rowCount += cqmss.Count;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("序号");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("明日计划");
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 1, 11));
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("填报人");
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("备注");
rowCount++;
for (int i = 0; i < cqmss.Count; i++)
{
row1 = sheet.GetRow(rowCount + i);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue((i + 1).ToString());
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(cqmss[i].CQMSTomorrowPlan);
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount + i, rowCount + i, 1, 11));
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(ConvertCompileManName(cqmss[i].ConstructionLogId));
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(cqmss[i].CQMSTomorrowPlanRemark);
}
rowCount += cqmss.Count;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle3;
cell3.SetCellValue("需要协调解决的问题");
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 0, 13));
rowCount++;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("序号");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("单位工程");
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("主要问题");
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle3;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 2, 6));
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("处理措施");
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle3;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 7, 10));
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("所属WBS");
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("填报人");
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("备注");
var problems = (from x in db.ZHGL_ConstructionLogProblem
where personLogIds.Contains(x.ConstructionLogId)
orderby x.UnitWorkId
select x).ToList();
rowCount++;
for (int i = 0; i < problems.Count; i++)
{
row1 = sheet.GetRow(rowCount + i);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue((i + 1).ToString());
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(BLL.UnitWorkService.GetUnitWorkName(problems[i].UnitWorkId));
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(problems[i].MainProblem);
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle3;
sheet.AddMergedRegion(new CellRangeAddress(rowCount + i, rowCount + i, 2, 6));
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(problems[i].HandlingMeasures);
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle3;
sheet.AddMergedRegion(new CellRangeAddress(rowCount + i, rowCount + i, 7, 10));
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(BLL.WorkPackageInitService.GetPackageContentByWorkPackageCode(problems[i].WorkPackageId));
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(ConvertCompileManName(problems[i].ConstructionLogId));
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(problems[i].ImportanceLevel);
}
rowCount += problems.Count;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle3;
cell3.SetCellValue("施工经理相关记录");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 0, 13));
rowCount++;
row1 = sheet.GetRow(rowCount);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("序号");
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("相关记录");
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle3;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 1, 11));
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("填报人");
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue("备注");
var records = (from x in db.ZHGL_ConstructionLogRecord
where personLogIds.Contains(x.ConstructionLogId)
select x).ToList();
rowCount++;
for (int i = 0; i < records.Count; i++)
{
row1 = sheet.GetRow(rowCount + i);
cell3 = row1.CreateCell(0);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue((i + 1).ToString());
cell3 = row1.CreateCell(1);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(records[i].Record);
cell3 = row1.CreateCell(2);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(3);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(4);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(5);
cell3.CellStyle = cellStyle3;
cell3 = row1.CreateCell(6);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(7);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(8);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(9);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(10);
cell3.CellStyle = cellStyle0;
cell3 = row1.CreateCell(11);
cell3.CellStyle = cellStyle0;
sheet.AddMergedRegion(new CellRangeAddress(rowCount + i, rowCount + i, 1, 11));
cell3 = row1.CreateCell(12);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(ConvertCompileManName(records[i].ConstructionLogId));
cell3 = row1.CreateCell(13);
cell3.CellStyle = cellStyle0;
cell3.SetCellValue(records[i].Remark);
}
// 第三步:写入文件流
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
{
workbook.Write(stream);
workbook.Close();
}
string fileName = Path.GetFileName(newUrl);
FileInfo info = new FileInfo(newUrl);
long fileSize = info.Length;
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Length", fileSize.ToString());
Response.TransmitFile(newUrl, 0, fileSize);
Response.Flush();
Response.Close();
File.Delete(newUrl);
}
}
#endregion
#region
/// <summary>
/// 删除明细按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete2_Click(object sender, EventArgs e)
{
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (this.GetButtonPower(BLL.Const.BtnSave))
{
if (this.Grid5.Hidden == true)
{
if (this.drpContractNo.SelectedValue == BLL.Const._Null && this.drpContractNo.SelectedItemArray.Length == 1)
{
Alert.ShowInTop("请选择合同编号!", MessageBoxIcon.Warning);
return;
}
if (this.drpUnitWork.SelectedValue == BLL.Const._Null && this.drpUnitWork.SelectedItemArray.Length == 1)
{
Alert.ShowInTop("请选择单位工程!", MessageBoxIcon.Warning);
return;
}
if (this.drpProfessional.SelectedValue == BLL.Const._Null && this.drpProfessional.SelectedItemArray.Length == 1)
{
Alert.ShowInTop("请选择专业工程!", MessageBoxIcon.Warning);
return;
}
}
Model.ZHGL_ProjectConstructionLog log = new Model.ZHGL_ProjectConstructionLog();
log.ProjectId = this.CurrUser.LoginProjectId;
log.FileCode = this.txtFileCode.Text.Trim();
log.CompileDate = Funs.GetNewDateTimeOrNow(this.txtCompileDate.Text.Trim());
log.Weather = this.txtWeather.Text.Trim();
log.Temperature = this.txtTemperature.Text.Trim();
log.CompileMan = this.CurrUser.PersonId;
string contractNo = string.Empty;
foreach (var item in this.drpContractNo.SelectedValueArray)
{
if (item != BLL.Const._Null)
{
contractNo += item + ",";
}
}
if (!string.IsNullOrEmpty(contractNo))
{
contractNo = contractNo.Substring(0, contractNo.Length - 1);
}
log.ContractNo = contractNo;
string unitWork = string.Empty;
foreach (var item in this.drpUnitWork.SelectedValueArray)
{
if (item != BLL.Const._Null)
{
unitWork += item + ",";
}
}
if (!string.IsNullOrEmpty(unitWork))
{
unitWork = unitWork.Substring(0, unitWork.Length - 1);
}
log.UnitWorks = unitWork;
string professional = string.Empty;
foreach (var item in this.drpProfessional.SelectedValueArray)
{
if (item != BLL.Const._Null)
{
professional += item + ",";
}
}
if (!string.IsNullOrEmpty(professional))
{
professional = professional.Substring(0, professional.Length - 1);
}
log.Professional = professional;
log.State = "1"; //已填报
log.Remark = this.txtRemark.Text.Trim();
log.WorkPostId = this.hdWorkPostId.Text.Trim();
log.MachineId = this.hdMachineId.Text.Trim();
if (!string.IsNullOrEmpty(this.ProjectConstructionLogId))
{
var updatelog = BLL.ProjectConstructionLogService.GetProjectConstructionLogById(this.ProjectConstructionLogId);
if (updatelog != null)
{
log.ProjectConstructionLogId = ProjectConstructionLogId;
BLL.ProjectConstructionLogService.UpdateProjectConstructionLog(log);
}
}
else
{
var personLog = (from x in Funs.DB.ZHGL_ProjectConstructionLog
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.CompileDate == Funs.GetNewDateTime(this.txtCompileDate.Text.Trim())
select x).FirstOrDefault();
if (personLog == null)
{
log.ProjectConstructionLogId = SQLHelper.GetNewID(typeof(Model.ZHGL_ProjectConstructionLog));
this.ProjectConstructionLogId = log.ProjectConstructionLogId;
BLL.ProjectConstructionLogService.AddProjectConstructionLog(log);
}
else
{
Alert.ShowInTop("当前日期项目施工日志已存在!", MessageBoxIcon.Warning);
return;
}
}
ShowNotify("发布成功!", MessageBoxIcon.Success);
InitTreeMenu();
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 关闭弹出窗体
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
ChangeText();
}
private void ChangeText()
{
DateTime today = DateTime.Now.Date;
if (!string.IsNullOrEmpty(this.txtCompileDate.Text.Trim()))
{
today = Convert.ToDateTime(this.txtCompileDate.Text.Trim()).Date;
}
var personLogIds = (from x in Funs.DB.ZHGL_ConstructionLog
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileDate == today
orderby x.CompileDate descending
select x.ConstructionLogId).ToList();
var workEfficiencys = from x in Funs.DB.ZHGL_ConstructionLogWorkEfficiency
where personLogIds.Contains(x.ConstructionLogId)
select x;
if (workEfficiencys.Count() > 0)
{
this.btnWorkEfficiency.Text = "已填报";
}
else
{
this.btnWorkEfficiency.Text = "未填报";
}
}
#endregion
#region
/// <summary>
/// 右键删除焊口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
if (this.GetButtonPower(BLL.Const.BtnDelete))
{
this.ProjectConstructionLogId = this.tvControlItem.SelectedNodeID;
var log = BLL.ProjectConstructionLogService.GetProjectConstructionLogById(ProjectConstructionLogId);
if (log != null)
{
BLL.ProjectConstructionLogService.DeleteProjectConstructionLogById(ProjectConstructionLogId);
ShowNotify("删除成功!", MessageBoxIcon.Success);
TextEmpty();
InitTreeMenu();
}
else
{
Alert.ShowInTop("请选择要删除的记录!", MessageBoxIcon.Warning);
}
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 单位工程转换
/// </summary>
/// <param name=""></param>
/// <returns></returns>
protected string ConvertUnitWorkName(object unitWorkId)
{
if (unitWorkId != null)
{
return BLL.UnitWorkService.GetUnitWorkName(unitWorkId.ToString());
}
else
{
return "";
}
}
/// <summary>
/// 填报人转换
/// </summary>
/// <param name=""></param>
/// <returns></returns>
protected string ConvertCompileManName(object constructionLogId)
{
string name = string.Empty;
if (constructionLogId != null)
{
Model.ZHGL_ConstructionLog log = BLL.ConstructionLogService.GetConstructionLogById(constructionLogId.ToString());
if (log != null)
{
name = BLL.Person_PersonsService.GetPersonsNameById(log.CompileMan);
}
}
return name;
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private bool GetButtonPower(string button)
{
return BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.ProjectConstructionLogMenuId, button);
}
#endregion
protected void drpContractNo_SelectedIndexChanged(object sender, EventArgs e)
{
List<string> contractNos = new List<string>();
foreach (var item in this.drpContractNo.SelectedValueArray)
{
if (item != BLL.Const._Null)
{
contractNos.Add(item);
}
}
UnitWorkService.InitContractUnitWorkDownList(drpUnitWork, this.CurrUser.LoginProjectId, contractNos, true);
}
protected void drpUnitWork_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpUnitWork.SelectedValue == BLL.Const._Null && this.drpUnitWork.SelectedItemArray.Length == 1)
{
this.Grid1.DataSource = null;
this.Grid1.DataBind();
this.Grid2.DataSource = null;
this.Grid2.DataBind();
this.Grid3.DataSource = null;
this.Grid3.DataBind();
this.Grid4.DataSource = null;
this.Grid4.DataBind();
}
else
{
DateTime today = DateTime.Now.Date;
if (!string.IsNullOrEmpty(this.txtCompileDate.Text.Trim()))
{
today = Convert.ToDateTime(this.txtCompileDate.Text.Trim()).Date;
}
Model.SGGLDB db = Funs.DB;
var personLogs = from x in db.ZHGL_ConstructionLog
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileDate == today
orderby x.CompileDate descending
select x;
var personLogIds = personLogs.Select(x => x.ConstructionLogId);
var allPersons = from x in db.ZHGL_ConstructionLogPerson
where personLogIds.Contains(x.ConstructionLogId)
select x;
var allMachines = from x in db.ZHGL_ConstructionLogMachine
where personLogIds.Contains(x.ConstructionLogId)
select x;
var allManagements = from x in db.ZHGL_ConstructionLogManagement
where personLogIds.Contains(x.ConstructionLogId)
orderby x.UnitWorkId
select x;
var allProblems = from x in db.ZHGL_ConstructionLogProblem
where personLogIds.Contains(x.ConstructionLogId)
orderby x.UnitWorkId
select x;
var allRecords = from x in db.ZHGL_ConstructionLogRecord
where personLogIds.Contains(x.ConstructionLogId)
select x;
var allHJGLs = from x in db.ZHGL_ConstructionLogHJGL
where personLogIds.Contains(x.ConstructionLogId)
select x;
List<Model.ConstructionLogPersonItem> personItems = new List<Model.ConstructionLogPersonItem>();
List<string> workPostList = Funs.GetStrListByStr(this.hdWorkPostId.Text, ',');
workPostList.Distinct();
foreach (var item in this.drpUnitWork.SelectedValueArray)
{
if (item != BLL.Const._Null)
{
Model.ConstructionLogPersonItem personItem = new Model.ConstructionLogPersonItem();
personItem.ConstructionLogPersonId = SQLHelper.GetNewID();
personItem.ConstructionLogId = ProjectConstructionLogId;
personItem.UnitWorkId = item;
int a = 0;
foreach (var workPost in workPostList)
{
int num = 0;
num = allPersons.Where(x => x.UnitWorkId == item && x.WorkPostId == workPost).ToList().Sum(x => x.Num ?? 0);
if (a == 0)
{
personItem.Num0 = num;
}
else if (a == 1)
{
personItem.Num1 = num;
}
else if (a == 2)
{
personItem.Num2 = num;
}
else if (a == 3)
{
personItem.Num3 = num;
}
else if (a == 4)
{
personItem.Num4 = num;
}
else if (a == 5)
{
personItem.Num5 = num;
}
else if (a == 6)
{
personItem.Num6 = num;
}
else if (a == 7)
{
personItem.Num7 = num;
}
else if (a == 8)
{
personItem.Num8 = num;
}
else if (a == 9)
{
personItem.Num9 = num;
}
else if (a == 10)
{
personItem.Num10 = num;
}
else if (a == 11)
{
personItem.Num11 = num;
}
else if (a == 12)
{
personItem.Num12 = num;
}
else if (a == 13)
{
personItem.Num13 = num;
}
else if (a == 14)
{
personItem.Num14 = num;
}
else if (a == 15)
{
personItem.Num15 = num;
}
else if (a == 16)
{
personItem.Num16 = num;
}
else if (a == 17)
{
personItem.Num17 = num;
}
else if (a == 18)
{
personItem.Num18 = num;
}
else if (a == 19)
{
personItem.Num19 = num;
}
else if (a == 20)
{
personItem.Num20 = num;
}
a++;
}
personItems.Add(personItem);
}
}
this.Grid1.DataSource = personItems;
this.Grid1.DataBind();
List<Model.ConstructionLogMachineItem> machineItems = new List<Model.ConstructionLogMachineItem>();
List<string> machineList = Funs.GetStrListByStr(this.hdMachineId.Text, ',');
foreach (var item in this.drpUnitWork.SelectedValueArray)
{
if (item != BLL.Const._Null)
{
Model.ConstructionLogMachineItem machineItem = new Model.ConstructionLogMachineItem();
machineItem.ConstructionLogMachineId = SQLHelper.GetNewID();
machineItem.ConstructionLogId = ProjectConstructionLogId;
machineItem.UnitWorkId = item;
int a = 0;
foreach (var machine in machineList)
{
int num = 0;
num = allMachines.Where(x => x.UnitWorkId == item && x.MachineId == machine).ToList().Sum(x => x.Num ?? 0);
if (a == 0)
{
machineItem.Num0 = num;
}
else if (a == 1)
{
machineItem.Num1 = num;
}
else if (a == 2)
{
machineItem.Num2 = num;
}
else if (a == 3)
{
machineItem.Num3 = num;
}
else if (a == 4)
{
machineItem.Num4 = num;
}
else if (a == 5)
{
machineItem.Num5 = num;
}
else if (a == 6)
{
machineItem.Num6 = num;
}
else if (a == 7)
{
machineItem.Num7 = num;
}
else if (a == 8)
{
machineItem.Num8 = num;
}
else if (a == 9)
{
machineItem.Num9 = num;
}
else if (a == 10)
{
machineItem.Num10 = num;
}
else if (a == 11)
{
machineItem.Num11 = num;
}
else if (a == 12)
{
machineItem.Num12 = num;
}
else if (a == 13)
{
machineItem.Num13 = num;
}
else if (a == 14)
{
machineItem.Num14 = num;
}
else if (a == 15)
{
machineItem.Num15 = num;
}
else if (a == 16)
{
machineItem.Num16 = num;
}
else if (a == 17)
{
machineItem.Num17 = num;
}
else if (a == 18)
{
machineItem.Num18 = num;
}
else if (a == 19)
{
machineItem.Num19 = num;
}
else if (a == 20)
{
machineItem.Num20 = num;
}
a++;
}
machineItems.Add(machineItem);
}
}
this.Grid2.DataSource = machineItems;
this.Grid2.DataBind();
this.Grid3.DataSource = allManagements;
this.Grid3.DataBind();
foreach (var item in allProblems)
{
item.WorkPackageId = BLL.WorkPackageInitService.GetPackageContentByWorkPackageCode(item.WorkPackageId);
}
this.Grid4.DataSource = allProblems;
this.Grid4.DataBind();
this.Grid5.DataSource = allRecords;
this.Grid5.DataBind();
this.Grid6.DataSource = allHJGLs;
this.Grid6.DataBind();
}
}
#region Grid行点击事件
/// <summary>
/// Grid行点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid3_RowCommand(object sender, GridCommandEventArgs e)
{
string id = this.Grid3.SelectedRow.RowID;
string unitWorkId = this.Grid3.SelectedRow.DataKeys[1].ToString();
//保存页面数据
List<Model.ZHGL_ConstructionLogManagement> items = new List<Model.ZHGL_ConstructionLogManagement>();
foreach (JObject mergedRow in Grid3.GetMergedData()) //专业管理
{
Model.ZHGL_ConstructionLogManagement newItem = new Model.ZHGL_ConstructionLogManagement();
int i = mergedRow.Value<int>("index");
JObject values = mergedRow.Value<JObject>("values");
newItem.ConstructionLogManagementId = values.Value<string>("ConstructionLogManagementId");
newItem.ConstructionLogId = this.ProjectConstructionLogId;
newItem.UnitWorkId = values.Value<string>("UnitWorkId");
newItem.TodayWork = values.Value<string>("TodayWork");
newItem.TomorrowWork = values.Value<string>("TomorrowWork");
newItem.Remark = values.Value<string>("Remark");
items.Add(newItem);
}
if (e.CommandName == "add")//增加
{
Model.ZHGL_ConstructionLogManagement newItem = new Model.ZHGL_ConstructionLogManagement();
newItem.ConstructionLogManagementId = SQLHelper.GetNewID();
newItem.UnitWorkId = unitWorkId;
items.Add(newItem);
items = items.OrderBy(x => x.UnitWorkId).ToList();
this.Grid3.DataSource = items;
this.Grid3.DataBind();
}
if (e.CommandName == "del")//删除
{
var w = items.FirstOrDefault(x => x.ConstructionLogManagementId == id);
if (w != null)
{
items.Remove(w);
}
items = items.OrderBy(x => x.UnitWorkId).ToList();
this.Grid3.DataSource = items;
this.Grid3.DataBind();
}
}
/// <summary>
/// Grid行点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid4_RowCommand(object sender, GridCommandEventArgs e)
{
string id = this.Grid4.SelectedRow.RowID;
string unitWorkId = this.Grid4.SelectedRow.DataKeys[1].ToString();
if (e.CommandName == "download")
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/ProjectConstructionLog&menuId={2}",
-1, id, Const.ProjectConstructionLogMenuId)));
}
else
{
//保存页面数据
List<Model.ZHGL_ConstructionLogProblem> items = new List<Model.ZHGL_ConstructionLogProblem>();
foreach (JObject mergedRow in Grid4.GetMergedData()) //专业管理
{
Model.ZHGL_ConstructionLogProblem newItem = new Model.ZHGL_ConstructionLogProblem();
int i = mergedRow.Value<int>("index");
JObject values = mergedRow.Value<JObject>("values");
newItem.ConstructionLogProblemId = values.Value<string>("ConstructionLogProblemId");
newItem.ConstructionLogId = this.ProjectConstructionLogId;
newItem.UnitWorkId = values.Value<string>("UnitWorkId");
newItem.MainProblem = values.Value<string>("MainProblem");
newItem.HandlingMeasures = values.Value<string>("HandlingMeasures");
newItem.WorkPackageId = BLL.WorkPackageInitService.GetWorkPackageCodeByPackageContent(values.Value<string>("WorkPackageId"));
newItem.ImportanceLevel = values.Value<string>("ImportanceLevel");
items.Add(newItem);
}
if (e.CommandName == "add")//增加
{
Model.ZHGL_ConstructionLogProblem newItem = new Model.ZHGL_ConstructionLogProblem();
newItem.ConstructionLogProblemId = SQLHelper.GetNewID();
newItem.UnitWorkId = unitWorkId;
items.Add(newItem);
items = items.OrderBy(x => x.UnitWorkId).ToList();
}
if (e.CommandName == "del")//删除
{
var w = items.FirstOrDefault(x => x.ConstructionLogProblemId == id);
if (w != null)
{
items.Remove(w);
}
items = items.OrderBy(x => x.UnitWorkId).ToList();
}
foreach (var item in items)
{
item.WorkPackageId = BLL.WorkPackageInitService.GetPackageContentByWorkPackageCode(item.WorkPackageId);
}
this.Grid4.DataSource = items;
this.Grid4.DataBind();
}
}
/// <summary>
/// Grid行点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid5_RowCommand(object sender, GridCommandEventArgs e)
{
string id = this.Grid5.SelectedRow.RowID;
//保存页面数据
List<Model.ZHGL_ConstructionLogRecord> items = new List<Model.ZHGL_ConstructionLogRecord>();
foreach (JObject mergedRow in Grid5.GetMergedData()) //专业管理
{
Model.ZHGL_ConstructionLogRecord newItem = new Model.ZHGL_ConstructionLogRecord();
int i = mergedRow.Value<int>("index");
JObject values = mergedRow.Value<JObject>("values");
newItem.ConstructionLogRecordId = values.Value<string>("ProjectConstructionLogRecordId");
newItem.ConstructionLogId = this.ProjectConstructionLogId;
newItem.Record = values.Value<string>("Record");
newItem.Remark = values.Value<string>("Remark");
items.Add(newItem);
}
if (e.CommandName == "del")//删除
{
var w = items.FirstOrDefault(x => x.ConstructionLogRecordId == id);
if (w != null)
{
items.Remove(w);
}
}
this.Grid5.DataSource = items;
this.Grid5.DataBind();
}
#endregion
protected void btnAdd_Click(object sender, EventArgs e)
{
//保存页面数据
List<Model.ZHGL_ConstructionLogRecord> items = new List<Model.ZHGL_ConstructionLogRecord>();
foreach (JObject mergedRow in Grid5.GetMergedData()) //专业管理
{
Model.ZHGL_ConstructionLogRecord item = new Model.ZHGL_ConstructionLogRecord();
int i = mergedRow.Value<int>("index");
JObject values = mergedRow.Value<JObject>("values");
item.ConstructionLogRecordId = values.Value<string>("ConstructionLogRecordId");
item.ConstructionLogId = this.ProjectConstructionLogId;
item.Record = values.Value<string>("Record");
item.Remark = values.Value<string>("Remark");
items.Add(item);
}
Model.ZHGL_ConstructionLogRecord newItem = new Model.ZHGL_ConstructionLogRecord();
newItem.ConstructionLogRecordId = SQLHelper.GetNewID();
items.Add(newItem);
this.Grid5.DataSource = items;
this.Grid5.DataBind();
}
protected void txtCompileDate_TextChanged(object sender, EventArgs e)
{
TextNew();
}
protected void imgBtnFile_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.txtCompileDate.Text.Trim()))
{
Alert.ShowInTop("请选择日期!", MessageBoxIcon.Warning);
return;
}
DateTime today = DateTime.Now.Date;
if (!string.IsNullOrEmpty(this.txtCompileDate.Text.Trim()))
{
today = Convert.ToDateTime(this.txtCompileDate.Text.Trim()).Date;
}
var personLogs = from x in Funs.DB.ZHGL_ConstructionLog
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileDate == today
orderby x.CompileDate descending
select x;
string logIds = string.Empty;
foreach (var personLog in personLogs)
{
logIds += personLog.ConstructionLogId + ",";
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&ConstructionLog=ConstructionLog&path=FileUpload/ConstructionLog&menuId={2}", -1, logIds, BLL.Const.ConstructionLogMenuId)));
}
protected void btnWorkEfficiency_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.txtCompileDate.Text.Trim()))
{
Alert.ShowInTop("请选择日期!", MessageBoxIcon.Warning);
return;
}
string contractNo = string.Empty;
foreach (var item in this.drpContractNo.SelectedValueArray)
{
if (item != BLL.Const._Null)
{
contractNo += item + ",";
}
}
if (!string.IsNullOrEmpty(contractNo))
{
contractNo = contractNo.Substring(0, contractNo.Length - 1);
}
string professional = string.Empty;
foreach (var item in this.drpProfessional.SelectedValueArray)
{
if (item != BLL.Const._Null)
{
professional += item + ",";
}
}
if (!string.IsNullOrEmpty(professional))
{
professional = professional.Substring(0, professional.Length - 1);
}
if (!string.IsNullOrEmpty(contractNo) && !string.IsNullOrEmpty(professional))
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectConstructionLogWorkEfficiency.aspx?CompileDate={0}&contractNo={1}&professional={2}&WorkPostId={3}&MachineId={4}", this.txtCompileDate.Text.Trim(), contractNo, professional, hdWorkPostId.Text, hdMachineId.Text, "导入 - ")));
}
else
{
Alert.ShowInTop("请选择合同编号和专业工程!", MessageBoxIcon.Warning);
}
}
}
}