2023-07-25 14:08:48 +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.JDGL.Check
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class PlanSet : PageBase
|
|
|
|
|
|
{
|
|
|
|
|
|
#region 加载
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 加载页面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
|
{
|
|
|
|
|
|
DataTable table = BLL.WorkPackageService.GetAllTreeDataTable(this.CurrUser.LoginProjectId);
|
|
|
|
|
|
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()))
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Web.UI.WebControls.CheckBox cbIsMileStone = (System.Web.UI.WebControls.CheckBox)(this.Grid1.Rows[i].FindControl("cbIsMileStone"));
|
|
|
|
|
|
cbIsMileStone.Visible = false;
|
|
|
|
|
|
foreach (GridColumn column in Grid1.Columns)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (column.ColumnIndex != 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Grid1.Rows[i].CellCssClasses[column.ColumnIndex] = "f-grid-cell-uneditable";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Web.UI.WebControls.CheckBox cbIsMileStone = (System.Web.UI.WebControls.CheckBox)(this.Grid1.Rows[i].FindControl("cbIsMileStone"));
|
|
|
|
|
|
Model.WBS_WorkPackage workPackage = BLL.WorkPackageService.GetWorkPackageByWorkPackageId(this.Grid1.Rows[i].DataKeys[2].ToString());
|
|
|
|
|
|
if (workPackage != null && workPackage.IsMileStone == true)
|
|
|
|
|
|
{
|
|
|
|
|
|
cbIsMileStone.Checked = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 保存
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 保存按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.PlanSetMenuId, BLL.Const.BtnSave))
|
|
|
|
|
|
{
|
|
|
|
|
|
Save();
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideReference());
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Save()
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
|
var workPackages = from x in db.WBS_WorkPackage
|
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId
|
|
|
|
|
|
select x;
|
|
|
|
|
|
var unitWorks = from x in db.WBS_UnitWork
|
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId
|
|
|
|
|
|
select x;
|
|
|
|
|
|
string[] ids = this.hdId.Text.Split(',');
|
|
|
|
|
|
if (ids.Length > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (JObject mergedRow in Grid1.GetMergedData())
|
|
|
|
|
|
{
|
|
|
|
|
|
JObject values = mergedRow.Value<JObject>("values");
|
|
|
|
|
|
int i = mergedRow.Value<int>("index");
|
|
|
|
|
|
if (this.Grid1.Rows[i].DataKeys[2] != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.WBS_WorkPackage workPackage = workPackages.FirstOrDefault(x => x.WorkPackageId == this.Grid1.Rows[i].DataKeys[2].ToString());
|
|
|
|
|
|
if (workPackage != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string weights = values.Value<string>("Weights");
|
|
|
|
|
|
string unit = values.Value<string>("Unit");
|
|
|
|
|
|
string planProjectQuantity = values.Value<string>("PlanProjectQuantity");
|
|
|
|
|
|
string realProjectQuantity = values.Value<string>("RealProjectQuantity");
|
|
|
|
|
|
string planStartDate = values.Value<string>("PlanStartDate");
|
|
|
|
|
|
string planEndDate = values.Value<string>("PlanEndDate");
|
2023-08-01 17:28:03 +08:00
|
|
|
|
string realStartDate = values.Value<string>("RealStartDate");
|
|
|
|
|
|
string preWorkCode = values.Value<string>("PreWorkCode");
|
2023-07-25 14:08:48 +08:00
|
|
|
|
System.Web.UI.WebControls.CheckBox cbIsMileStone = (System.Web.UI.WebControls.CheckBox)(this.Grid1.Rows[i].FindControl("cbIsMileStone"));
|
|
|
|
|
|
workPackage.Weights = Funs.GetNewDecimal(weights);
|
|
|
|
|
|
workPackage.Unit = unit;
|
|
|
|
|
|
workPackage.PlanProjectQuantity = Funs.GetNewDecimal(planProjectQuantity);
|
|
|
|
|
|
workPackage.RealProjectQuantity = Funs.GetNewDecimal(realProjectQuantity);
|
|
|
|
|
|
workPackage.PlanStartDate = Funs.GetNewDateTime(planStartDate);
|
|
|
|
|
|
workPackage.PlanEndDate = Funs.GetNewDateTime(planEndDate);
|
2023-08-01 17:28:03 +08:00
|
|
|
|
workPackage.RealStartDate = Funs.GetNewDateTime(realStartDate);
|
2023-07-25 14:08:48 +08:00
|
|
|
|
workPackage.IsMileStone = cbIsMileStone.Checked;
|
2023-08-01 17:28:03 +08:00
|
|
|
|
workPackage.PreWorkCode = preWorkCode;
|
2023-07-25 14:08:48 +08:00
|
|
|
|
BLL.WorkPackageService.UpdateWorkPackage(workPackage);
|
2023-08-01 17:28:03 +08:00
|
|
|
|
if (workPackage.PlanStartDate != null || workPackage.PlanEndDate != null || workPackage.RealStartDate != null)
|
2023-07-25 14:08:48 +08:00
|
|
|
|
{
|
2023-08-01 17:28:03 +08:00
|
|
|
|
BLL.WorkPackageService.UpdateWorkPackages(db, workPackage, workPackage.PlanStartDate, workPackage.PlanEndDate, workPackage.RealStartDate, null);
|
2023-07-25 14:08:48 +08:00
|
|
|
|
var unitWork = unitWorks.FirstOrDefault(x => x.UnitWorkId == workPackage.UnitWorkId);
|
|
|
|
|
|
if (workPackage.PlanStartDate != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (unitWork.PlanStartDate == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
unitWork.PlanStartDate = workPackage.PlanStartDate;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (unitWork.PlanStartDate > workPackage.PlanStartDate)
|
|
|
|
|
|
{
|
|
|
|
|
|
unitWork.PlanStartDate = workPackage.PlanStartDate;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (workPackage.PlanEndDate != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (unitWork.PlanEndDate == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
unitWork.PlanEndDate = workPackage.PlanEndDate;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (unitWork.PlanEndDate < workPackage.PlanEndDate)
|
|
|
|
|
|
{
|
|
|
|
|
|
unitWork.PlanEndDate = workPackage.PlanEndDate;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-08-01 17:28:03 +08:00
|
|
|
|
if (workPackage.RealStartDate != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (unitWork.RealStartDate == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
unitWork.RealStartDate = workPackage.RealStartDate;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (unitWork.RealStartDate > workPackage.RealStartDate)
|
|
|
|
|
|
{
|
|
|
|
|
|
unitWork.RealStartDate = workPackage.RealStartDate;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-07-25 14:08:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|