提交代码

This commit is contained in:
2023-10-25 16:58:47 +08:00
parent d1a4134e7b
commit 2e3ff9873c
23 changed files with 329 additions and 122 deletions
@@ -107,10 +107,35 @@ namespace FineUIPro.Web.PZHGL.InformationProject
if (!IsPostBack)
{
this.txtMonth.Text = string.Format("{0:yyyy-MM}", 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);
}
}
#endregion
protected void drpContractNo_SelectedIndexChanged(object sender, EventArgs e)
{
this.lblUnitName.Text = string.Empty;
this.btnSave.Hidden = false;
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;
}
this.btnSave.Hidden = true;
}
this.Grid1.DataSource = null;
this.Grid1.DataBind();
}
private void GetData()
{
Model.SGGLDB db = Funs.DB;
@@ -135,6 +160,10 @@ namespace FineUIPro.Web.PZHGL.InformationProject
}
}
}
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
@@ -183,63 +212,70 @@ namespace FineUIPro.Web.PZHGL.InformationProject
{
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())
if (this.Grid1.Rows.Count > 0)
{
JObject values = mergedRow.Value<JObject>("values");
int a = mergedRow.Value<int>("index");
if (this.Grid1.Rows[a].DataKeys[2] != null)
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())
{
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++)
JObject values = mergedRow.Value<JObject>("values");
int a = mergedRow.Value<int>("index");
if (this.Grid1.Rows[a].DataKeys[2] != null)
{
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);
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);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
}
else
{