2023-10-07 15:27:02 +08:00
|
|
|
|
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 ConstructionLogWorkEfficiency : PageBase
|
|
|
|
|
|
{
|
|
|
|
|
|
#region 定义变量
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 列数量
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public int ColumnNum
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return (int)ViewState["ColumnNum"];
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewState["ColumnNum"] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 加载表头
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
protected void Page_Init(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 表头
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 表头
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void InitGrid()
|
|
|
|
|
|
{
|
|
|
|
|
|
ColumnNum = 0;
|
|
|
|
|
|
List<string> workPostIds = Funs.GetStrListByStr(Request.Params["WorkPostId"], ',');
|
|
|
|
|
|
List<string> machineIds = Funs.GetStrListByStr(Request.Params["MachineId"], ',');
|
|
|
|
|
|
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;
|
|
|
|
|
|
NumberBox numPlan = new NumberBox();
|
|
|
|
|
|
numPlan.NoNegative = true;
|
|
|
|
|
|
numPlan.NoDecimal = false;
|
|
|
|
|
|
rd1.Editor.Add(numPlan);
|
|
|
|
|
|
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;
|
|
|
|
|
|
NumberBox numPlan = new NumberBox();
|
|
|
|
|
|
numPlan.NoNegative = true;
|
|
|
|
|
|
numPlan.NoDecimal = false;
|
|
|
|
|
|
rd1.Editor.Add(numPlan);
|
|
|
|
|
|
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)
|
|
|
|
|
|
{
|
|
|
|
|
|
string contractNo = Request.Params["contractNo"];
|
|
|
|
|
|
string professional = Request.Params["professional"];
|
|
|
|
|
|
string constructionLogId = Request.Params["ConstructionLogId"];
|
2023-10-11 10:19:12 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(Request.Params["View"]))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnSave.Hidden = true;
|
|
|
|
|
|
}
|
2023-10-07 15:27:02 +08:00
|
|
|
|
List<string> contractNoList = Funs.GetStrListByStr(contractNo, ',');
|
|
|
|
|
|
List<string> professionalList = Funs.GetStrListByStr(professional, ',');
|
|
|
|
|
|
List<string> workPostIds = Funs.GetStrListByStr(Request.Params["WorkPostId"], ',');
|
|
|
|
|
|
List<string> machineIds = Funs.GetStrListByStr(Request.Params["MachineId"], ',');
|
|
|
|
|
|
DataTable table = BLL.PhtglContractTrackService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty, contractNoList, professionalList, workPostIds, machineIds, constructionLogId);
|
|
|
|
|
|
Grid1.DataSource = table;
|
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
|
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(this.Grid1.Rows[i].DataKeys[2].ToString()))
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (GridColumn column in Grid1.Columns)
|
|
|
|
|
|
{
|
2023-10-24 17:29:27 +08:00
|
|
|
|
if (column.ColumnIndex > 6)
|
2023-10-07 15:27:02 +08:00
|
|
|
|
{
|
2023-10-24 17:29:27 +08:00
|
|
|
|
if (column.ColumnIndex > 9)
|
2023-10-07 15:27:02 +08:00
|
|
|
|
{
|
|
|
|
|
|
GroupField gf1 = column as GroupField;
|
|
|
|
|
|
foreach (var column1 in gf1.Columns)
|
|
|
|
|
|
{
|
|
|
|
|
|
GroupField gf2 = column1 as GroupField;
|
|
|
|
|
|
foreach (var column2 in gf2.Columns)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Grid1.Rows[i].CellCssClasses[column2.ColumnIndex] = "f-grid-cell-uneditable";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Grid1.Rows[i].CellCssClasses[column.ColumnIndex] = "f-grid-cell-uneditable";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 保存
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 保存按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Save();
|
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
|
|
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Save()
|
|
|
|
|
|
{
|
|
|
|
|
|
string constructionLogId = Request.Params["ConstructionLogId"];
|
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
|
BLL.ConstructionLogWorkEfficiencyService.DeleteConstructionLogWorkEfficiencysByConstructionLogId(constructionLogId);
|
|
|
|
|
|
List<string> workPostIds = Funs.GetStrListByStr(Request.Params["WorkPostId"], ',');
|
|
|
|
|
|
List<string> machineIds = Funs.GetStrListByStr(Request.Params["MachineId"], ',');
|
|
|
|
|
|
foreach (JObject mergedRow in Grid1.GetMergedData())
|
|
|
|
|
|
{
|
|
|
|
|
|
JObject values = mergedRow.Value<JObject>("values");
|
|
|
|
|
|
int a = mergedRow.Value<int>("index");
|
|
|
|
|
|
if (this.Grid1.Rows[a].DataKeys[2] != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string physicalCompletionQuantity = values.Value<string>("PhysicalCompletionQuantity");
|
|
|
|
|
|
string materialConsumption = values.Value<string>("MaterialConsumption");
|
|
|
|
|
|
for (int i = 0; i < workPostIds.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.ZHGL_ConstructionLogWorkEfficiency workEfficiency = new Model.ZHGL_ConstructionLogWorkEfficiency();
|
|
|
|
|
|
workEfficiency.ConstructionLogWorkEfficiencyId = SQLHelper.GetNewID();
|
|
|
|
|
|
workEfficiency.ConstructionLogId = constructionLogId;
|
|
|
|
|
|
workEfficiency.ContractTrackId = this.Grid1.Rows[a].DataKeys[2].ToString();
|
|
|
|
|
|
workEfficiency.PhysicalCompletionQuantity = Funs.GetNewDecimal(physicalCompletionQuantity);
|
|
|
|
|
|
workEfficiency.MaterialConsumption = Funs.GetNewDecimal(materialConsumption);
|
|
|
|
|
|
workEfficiency.Type = "Person";
|
|
|
|
|
|
workEfficiency.TypeId = workPostIds[i];
|
|
|
|
|
|
workEfficiency.ConsumeHours = Funs.GetNewDecimal(values.Value<string>("PersonConsumeHours" + i.ToString()));
|
|
|
|
|
|
BLL.ConstructionLogWorkEfficiencyService.AddConstructionLogWorkEfficiency(workEfficiency);
|
|
|
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < machineIds.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.ZHGL_ConstructionLogWorkEfficiency workEfficiency = new Model.ZHGL_ConstructionLogWorkEfficiency();
|
|
|
|
|
|
workEfficiency.ConstructionLogWorkEfficiencyId = SQLHelper.GetNewID();
|
|
|
|
|
|
workEfficiency.ConstructionLogId = constructionLogId;
|
|
|
|
|
|
workEfficiency.ContractTrackId = this.Grid1.Rows[a].DataKeys[2].ToString();
|
|
|
|
|
|
workEfficiency.PhysicalCompletionQuantity = Funs.GetNewDecimal(physicalCompletionQuantity);
|
|
|
|
|
|
workEfficiency.MaterialConsumption = Funs.GetNewDecimal(materialConsumption);
|
|
|
|
|
|
workEfficiency.Type = "Machine";
|
|
|
|
|
|
workEfficiency.TypeId = machineIds[i];
|
|
|
|
|
|
workEfficiency.ConsumeHours = Funs.GetNewDecimal(values.Value<string>("MachineConsumeHours" + i.ToString()));
|
|
|
|
|
|
BLL.ConstructionLogWorkEfficiencyService.AddConstructionLogWorkEfficiency(workEfficiency);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|