修改员工考核
This commit is contained in:
@@ -0,0 +1,230 @@
|
||||
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"];
|
||||
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)
|
||||
{
|
||||
if (column.ColumnIndex != 0 && column.ColumnIndex != 1 && column.ColumnIndex != 2)
|
||||
{
|
||||
if (column.ColumnIndex > 5)
|
||||
{
|
||||
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;
|
||||
var oldViewInfos = from x in db.ZHGL_ConstructionLogWorkEfficiency
|
||||
where x.ConstructionLogId == constructionLogId
|
||||
select x;
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user