增加月工效和项目工效

This commit is contained in:
2023-10-20 14:34:35 +08:00
parent 2abb426abe
commit 88c39643fa
18 changed files with 1565 additions and 113 deletions
@@ -107,7 +107,6 @@ namespace FineUIPro.Web.PZHGL.InformationProject
if (!IsPostBack)
{
this.txtMonth.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
GetData();
}
}
#endregion
@@ -151,37 +150,15 @@ namespace FineUIPro.Web.PZHGL.InformationProject
DataTable table = BLL.PhtglContractTrackService.GetMonthProjectAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty, contractNoList, professionalList, workPostIds, machineIds, startDate, endDate);
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";
}
}
}
}
}
}
protected void txtMonth_TextChanged(object sender, EventArgs e)
#region
/// <summary>
/// 统计
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void BtnAnalyse_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.txtMonth.Text.Trim()))
{
@@ -194,5 +171,81 @@ namespace FineUIPro.Web.PZHGL.InformationProject
Alert.ShowInTop("请选择月份!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.txtMonth.Text.Trim()))
{
Model.SGGLDB db = Funs.DB;
DateTime month = Funs.GetNewDateTimeOrNow(this.txtMonth.Text.Trim() + "-01");
BLL.ConstructionLogWorkEfficiencyMonthService.DeleteConstructionLogWorkEfficiencyMonthsByConstructionLogId(this.CurrUser.LoginProjectId, month);
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();
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");
string unitOfMeasurement = values.Value<string>("UnitOfMeasurement");
for (int i = 0; i < workPostIds.Count; i++)
{
Model.ZHGL_ConstructionLogWorkEfficiencyMonth workEfficiency = new Model.ZHGL_ConstructionLogWorkEfficiencyMonth();
workEfficiency.ConstructionLogWorkEfficiencyMonthId = SQLHelper.GetNewID();
workEfficiency.ProjectId = this.CurrUser.LoginProjectId;
workEfficiency.Month = month;
workEfficiency.ContractTrackId = this.Grid1.Rows[a].DataKeys[2].ToString();
workEfficiency.PhysicalCompletionQuantity = Funs.GetNewDecimal(physicalCompletionQuantity);
workEfficiency.MaterialConsumption = Funs.GetNewDecimal(materialConsumption);
workEfficiency.UnitOfMeasurement = unitOfMeasurement;
workEfficiency.Type = "Person";
workEfficiency.TypeId = workPostIds[i];
workEfficiency.ConsumeHours = Funs.GetNewDecimal(values.Value<string>("PersonConsumeHours" + i.ToString()));
workEfficiency.WorkEfficiency = Funs.GetNewDecimal(values.Value<string>("PersonWorkEfficiency" + i.ToString()));
BLL.ConstructionLogWorkEfficiencyMonthService.AddConstructionLogWorkEfficiencyMonth(workEfficiency);
}
for (int i = 0; i < machineIds.Count; i++)
{
Model.ZHGL_ConstructionLogWorkEfficiencyMonth workEfficiency = new Model.ZHGL_ConstructionLogWorkEfficiencyMonth();
workEfficiency.ConstructionLogWorkEfficiencyMonthId = SQLHelper.GetNewID();
workEfficiency.ProjectId = this.CurrUser.LoginProjectId;
workEfficiency.Month = month;
workEfficiency.ContractTrackId = this.Grid1.Rows[a].DataKeys[2].ToString();
workEfficiency.PhysicalCompletionQuantity = Funs.GetNewDecimal(physicalCompletionQuantity);
workEfficiency.MaterialConsumption = Funs.GetNewDecimal(materialConsumption);
workEfficiency.UnitOfMeasurement = unitOfMeasurement;
workEfficiency.Type = "Machine";
workEfficiency.TypeId = machineIds[i];
workEfficiency.ConsumeHours = Funs.GetNewDecimal(values.Value<string>("MachineConsumeHours" + i.ToString()));
workEfficiency.WorkEfficiency = Funs.GetNewDecimal(values.Value<string>("MachineWorkEfficiency" + i.ToString()));
BLL.ConstructionLogWorkEfficiencyMonthService.AddConstructionLogWorkEfficiencyMonth(workEfficiency);
}
}
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
}
else
{
Alert.ShowInTop("请选择月份!", MessageBoxIcon.Warning);
}
}
#endregion
}
}