194 lines
8.5 KiB
C#
194 lines
8.5 KiB
C#
using BLL;
|
||
using Newtonsoft.Json.Linq;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using System.Web.UI.WebControls;
|
||
|
||
namespace FineUIPro.Web.PZHGL.InformationProject
|
||
{
|
||
public partial class DayConstructionLogWorkEfficiency : PageBase
|
||
{
|
||
/// <summary>
|
||
/// 加载表头
|
||
/// </summary>
|
||
protected void Page_Init(object sender, EventArgs e)
|
||
{
|
||
InitGrid();
|
||
}
|
||
|
||
#region 表头
|
||
/// <summary>
|
||
/// 表头
|
||
/// </summary>
|
||
private void InitGrid()
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
var workEfficiencys = from x in db.ZHGL_ConstructionLogWorkEfficiency
|
||
join y in db.ZHGL_ConstructionLog on x.ConstructionLogId equals y.ConstructionLogId
|
||
where y.ProjectId == this.CurrUser.LoginProjectId
|
||
select x;
|
||
List<string> workPostIds = (from x in workEfficiencys
|
||
where x.Type == "Person"
|
||
select x.TypeId).Distinct().ToList();
|
||
List<string> machineIds = (from x in workEfficiencys
|
||
where x.Type == "Machine"
|
||
select x.TypeId).Distinct().ToList();
|
||
GroupField gf1 = new GroupField();
|
||
gf1.ColumnID = "Person";
|
||
gf1.HeaderText = "人工消耗(工·h)";
|
||
gf1.HeaderTextAlign = TextAlign.Center;
|
||
for (int i = 0; i < workPostIds.Count; i++)
|
||
{
|
||
GroupField gf = new GroupField();
|
||
gf.ColumnID = "Person" + i.ToString();
|
||
gf.HeaderText = BLL.WorkPostService.getWorkPostNameById(workPostIds[i]);
|
||
gf.HeaderTextAlign = TextAlign.Center;
|
||
RenderField rd1 = new RenderField();
|
||
rd1.ColumnID = "PersonConsumeHours" + i.ToString();
|
||
rd1.Width = Unit.Pixel(100);
|
||
rd1.DataField = "PersonConsumeHours" + i.ToString();
|
||
rd1.FieldType = FieldType.Double;
|
||
rd1.HeaderText = "消耗工时";
|
||
rd1.HeaderTextAlign = TextAlign.Center;
|
||
gf.Columns.Add(rd1);
|
||
RenderField rd2 = new RenderField();
|
||
rd2.ColumnID = "PersonWorkEfficiency" + i.ToString();
|
||
rd2.Width = Unit.Pixel(100);
|
||
rd2.DataField = "PersonWorkEfficiency" + i.ToString();
|
||
rd2.FieldType = FieldType.Double;
|
||
rd2.HeaderText = "工效";
|
||
rd2.HeaderTextAlign = TextAlign.Center;
|
||
gf.Columns.Add(rd2);
|
||
gf1.Columns.Add(gf);
|
||
}
|
||
Grid1.Columns.Add(gf1);
|
||
GroupField gf2 = new GroupField();
|
||
gf2.ColumnID = "Machine";
|
||
gf2.HeaderText = "机械消耗(台·h)";
|
||
gf2.HeaderTextAlign = TextAlign.Center;
|
||
for (int i = 0; i < machineIds.Count; i++)
|
||
{
|
||
GroupField gf = new GroupField();
|
||
gf.ColumnID = "Machine" + i.ToString();
|
||
gf.HeaderText = BLL.SpecialEquipmentService.GetSpecialEquipmentNameById(machineIds[i]);
|
||
gf.HeaderTextAlign = TextAlign.Center;
|
||
RenderField rd1 = new RenderField();
|
||
rd1.ColumnID = "MachineConsumeHours" + i.ToString();
|
||
rd1.Width = Unit.Pixel(100);
|
||
rd1.DataField = "MachineConsumeHours" + i.ToString();
|
||
rd1.FieldType = FieldType.Double;
|
||
rd1.HeaderText = "消耗台时";
|
||
rd1.HeaderTextAlign = TextAlign.Center;
|
||
gf.Columns.Add(rd1);
|
||
RenderField rd2 = new RenderField();
|
||
rd2.ColumnID = "MachineWorkEfficiency" + i.ToString();
|
||
rd2.Width = Unit.Pixel(100);
|
||
rd2.DataField = "MachineWorkEfficiency" + i.ToString();
|
||
rd2.FieldType = FieldType.Double;
|
||
rd2.HeaderText = "工效";
|
||
rd2.HeaderTextAlign = TextAlign.Center;
|
||
gf.Columns.Add(rd2);
|
||
gf2.Columns.Add(gf);
|
||
}
|
||
Grid1.Columns.Add(gf2);
|
||
}
|
||
#endregion
|
||
|
||
#region 加载
|
||
/// <summary>
|
||
/// 加载页面
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||
//合同编号
|
||
this.drpContractNo.DataTextField = "ContractNum";
|
||
this.drpContractNo.DataValueField = "ContractId";
|
||
this.drpContractNo.DataSource = BLL.PHTGL_ContractReviewService.GetContractReview_CompleteData(this.CurrUser.LoginProjectId);
|
||
this.drpContractNo.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpContractNo);
|
||
GetData();
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
protected void drpContractNo_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
this.lblUnitName.Text = string.Empty;
|
||
if (this.drpContractNo.SelectedValue != BLL.Const._Null)
|
||
{
|
||
var contractTrack = (from x in Funs.DB.PHTGL_ContractTrack
|
||
where x.ContractId == this.drpContractNo.SelectedValue && x.ConstructionSubcontractor != null && x.ConstructionSubcontractor != string.Empty
|
||
select x).FirstOrDefault();
|
||
if (contractTrack != null)
|
||
{
|
||
this.lblUnitName.Text = contractTrack.ConstructionSubcontractor;
|
||
}
|
||
}
|
||
GetData();
|
||
}
|
||
|
||
private void GetData()
|
||
{
|
||
Model.SGGLDB db = Funs.DB;
|
||
string contractNo = string.Empty, professional = string.Empty;
|
||
var personLogs = from x in db.ZHGL_ConstructionLog
|
||
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileDate == Funs.GetNewDateTime(this.txtCompileDate.Text.Trim())
|
||
orderby x.CompileDate descending
|
||
select x;
|
||
if (personLogs.Count() > 0)
|
||
{
|
||
foreach (var personLog in personLogs)
|
||
{
|
||
if (!string.IsNullOrEmpty(personLog.ContractNo))
|
||
{
|
||
contractNo += "," + personLog.ContractNo;
|
||
}
|
||
if (!string.IsNullOrEmpty(personLog.Professional))
|
||
{
|
||
professional += "," + personLog.Professional;
|
||
}
|
||
}
|
||
}
|
||
if (this.drpContractNo.SelectedValue != BLL.Const._Null)
|
||
{
|
||
contractNo = this.drpContractNo.SelectedValue;
|
||
}
|
||
List<string> contractNoList = Funs.GetStrListByStr(contractNo, ',');
|
||
List<string> professionalList = Funs.GetStrListByStr(professional, ',');
|
||
var workEfficiencys = from x in db.ZHGL_ConstructionLogWorkEfficiency
|
||
join y in db.ZHGL_ConstructionLog on x.ConstructionLogId equals y.ConstructionLogId
|
||
where y.ProjectId == this.CurrUser.LoginProjectId
|
||
select x;
|
||
List<string> workPostIds = (from x in workEfficiencys
|
||
where x.Type == "Person"
|
||
select x.TypeId).Distinct().ToList();
|
||
List<string> machineIds = (from x in workEfficiencys
|
||
where x.Type == "Machine"
|
||
select x.TypeId).Distinct().ToList();
|
||
DataTable table = BLL.PhtglContractTrackService.GetProjectAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty, contractNoList, professionalList, workPostIds, machineIds, this.txtCompileDate.Text.Trim());
|
||
Grid1.DataSource = table;
|
||
Grid1.DataBind();
|
||
}
|
||
|
||
protected void txtCompileDate_TextChanged(object sender, EventArgs e)
|
||
{
|
||
if (!string.IsNullOrEmpty(this.txtCompileDate.Text.Trim()))
|
||
{
|
||
GetData();
|
||
}
|
||
else
|
||
{
|
||
Grid1.DataSource = null;
|
||
Grid1.DataBind();
|
||
Alert.ShowInTop("请选择日期!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
}
|
||
} |