提交代码

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
@@ -30,6 +30,8 @@
<Items>
<f:DatePicker ID="txtCompileDate" runat="server" Label="日期" LabelAlign="Right" LabelWidth="120px" AutoPostBack="true" OnTextChanged="txtCompileDate_TextChanged"></f:DatePicker>
<f:TextBox runat="server" ID="hdId" Hidden="true"></f:TextBox>
<f:DropDownList ID="drpContractNo" runat="server" Label="合同编号" LabelAlign="Right" EnableEdit="true" LabelWidth="120px" AutoPostBack="true" OnSelectedIndexChanged="drpContractNo_SelectedIndexChanged"></f:DropDownList>
<f:Label runat="server" Label="施工分包商" ID="lblUnitName" LabelWidth="150px" LabelAlign="Right"></f:Label>
<f:ToolbarFill runat="server"></f:ToolbarFill>
</Items>
</f:Toolbar>
@@ -107,11 +107,33 @@ namespace FineUIPro.Web.PZHGL.InformationProject
if (!IsPostBack)
{
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", 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);
GetData();
}
}
#endregion
protected void drpContractNo_SelectedIndexChanged(object sender, EventArgs e)
{
this.lblUnitName.Text = string.Empty;
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;
}
}
GetData();
}
private void GetData()
{
Model.SGGLDB db = Funs.DB;
@@ -134,6 +156,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
@@ -74,5 +74,23 @@ namespace FineUIPro.Web.PZHGL.InformationProject {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox hdId;
/// <summary>
/// drpContractNo 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpContractNo;
/// <summary>
/// lblUnitName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lblUnitName;
}
}
@@ -29,6 +29,8 @@
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
<Items>
<f:DatePicker ID="txtMonth" runat="server" Label="月份" LabelAlign="Right" DateFormatString="yyyy-MM" DisplayType="Month" AutoPostBack="true" OnTextChanged="txtMonth_TextChanged" LabelWidth="120px"></f:DatePicker>
<f:DropDownList ID="drpContractNo" runat="server" Label="合同编号" LabelAlign="Right" EnableEdit="true" LabelWidth="120px" AutoPostBack="true" OnSelectedIndexChanged="drpContractNo_SelectedIndexChanged"></f:DropDownList>
<f:Label runat="server" Label="施工分包商" ID="lblUnitName" LabelWidth="150px" LabelAlign="Right"></f:Label>
<f:TextBox runat="server" ID="hdId" Hidden="true"></f:TextBox>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="BtnAnalyse" Text="统计" Icon="ChartPie"
@@ -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
{
@@ -66,6 +66,24 @@ namespace FineUIPro.Web.PZHGL.InformationProject {
/// </remarks>
protected global::FineUIPro.DatePicker txtMonth;
/// <summary>
/// drpContractNo 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpContractNo;
/// <summary>
/// lblUnitName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lblUnitName;
/// <summary>
/// hdId 控件。
/// </summary>