增加月工效和项目工效
This commit is contained in:
@@ -147,11 +147,11 @@ namespace FineUIPro.Web.PZHGL.InformationProject
|
||||
DateTime? endTime = startTime.HasValue ? startTime.Value.AddMonths(1) : System.DateTime.Now;
|
||||
|
||||
this.tvControlItem.Nodes.Clear();
|
||||
var persons = from x in Funs.DB.Person_Persons
|
||||
var persons = (from x in Funs.DB.Person_Persons
|
||||
join y in Funs.DB.ZHGL_ConstructionLog
|
||||
on x.PersonId equals y.CompileMan
|
||||
where y.ProjectId == this.CurrUser.LoginProjectId && y.CompileDate >= startTime && y.CompileDate < endTime
|
||||
select x;
|
||||
select x).Distinct().ToList();
|
||||
foreach (var person in persons)
|
||||
{
|
||||
var logs = from x in Funs.DB.ZHGL_ConstructionLog
|
||||
|
||||
@@ -186,9 +186,6 @@ namespace FineUIPro.Web.PZHGL.InformationProject
|
||||
{
|
||||
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"], ',');
|
||||
|
||||
@@ -54,27 +54,9 @@
|
||||
HeaderText="材料消耗量(净量+损耗量)" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
</Columns>
|
||||
<Listeners>
|
||||
<f:Listener Event="afteredit" Handler="onGridAfterEdit" />
|
||||
</Listeners>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var hdIdClientID = '<%= hdId.ClientID %>';
|
||||
|
||||
function onGridAfterEdit(event, value, params) {
|
||||
var me = this, columnId = params.columnId, rowId = params.rowId;
|
||||
if (columnId.indexOf('ConsumeHours') != -1) {
|
||||
var physicalCompletionQuantity = me.getCellValue(rowId, 'PhysicalCompletionQuantity');
|
||||
var hours = me.getCellValue(rowId, columnId);
|
||||
var workEfficiencyId = columnId.replace('ConsumeHours', 'WorkEfficiency');
|
||||
if (physicalCompletionQuantity.toString() != "" && hours.toString() != "") {
|
||||
me.updateCellValue(rowId, workEfficiencyId, (physicalCompletionQuantity / hours).toFixed(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -149,34 +149,6 @@ namespace FineUIPro.Web.PZHGL.InformationProject
|
||||
DataTable table = BLL.PhtglContractTrackService.GetProjectAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty, contractNoList, professionalList, workPostIds, machineIds, this.txtCompileDate.Text.Trim());
|
||||
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 txtCompileDate_TextChanged(object sender, EventArgs e)
|
||||
|
||||
+7
-19
@@ -28,9 +28,15 @@
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
|
||||
<Items>
|
||||
<f:DatePicker ID="txtMonth" runat="server" Label="月份" LabelAlign="Right" DateFormatString="yyyy-MM" LabelWidth="120px" AutoPostBack="true" OnTextChanged="txtMonth_TextChanged"></f:DatePicker>
|
||||
<f:DatePicker ID="txtMonth" runat="server" Label="月份" LabelAlign="Right" DateFormatString="yyyy-MM" DisplayType="Month" LabelWidth="120px"></f:DatePicker>
|
||||
<f:TextBox runat="server" ID="hdId" Hidden="true"></f:TextBox>
|
||||
<f:ToolbarFill runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="BtnAnalyse" Text="统计" Icon="ChartPie"
|
||||
runat="server" OnClick="BtnAnalyse_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" Text="保存"
|
||||
OnClick="btnSave_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
@@ -54,27 +60,9 @@
|
||||
HeaderText="材料消耗量(净量+损耗量)" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
</Columns>
|
||||
<Listeners>
|
||||
<f:Listener Event="afteredit" Handler="onGridAfterEdit" />
|
||||
</Listeners>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var hdIdClientID = '<%= hdId.ClientID %>';
|
||||
|
||||
function onGridAfterEdit(event, value, params) {
|
||||
var me = this, columnId = params.columnId, rowId = params.rowId;
|
||||
if (columnId.indexOf('ConsumeHours') != -1) {
|
||||
var physicalCompletionQuantity = me.getCellValue(rowId, 'PhysicalCompletionQuantity');
|
||||
var hours = me.getCellValue(rowId, columnId);
|
||||
var workEfficiencyId = columnId.replace('ConsumeHours', 'WorkEfficiency');
|
||||
if (physicalCompletionQuantity.toString() != "" && hours.toString() != "") {
|
||||
me.updateCellValue(rowId, workEfficiencyId, (physicalCompletionQuantity / hours).toFixed(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+83
-30
@@ -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
|
||||
}
|
||||
}
|
||||
Generated
+18
@@ -74,5 +74,23 @@ namespace FineUIPro.Web.PZHGL.InformationProject {
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox hdId;
|
||||
|
||||
/// <summary>
|
||||
/// BtnAnalyse 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button BtnAnalyse;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
}
|
||||
}
|
||||
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProjectConstructionLogWorkEfficiencySum.aspx.cs" Inherits="FineUIPro.Web.PZHGL.InformationProject.ProjectConstructionLogWorkEfficiencySum" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title>工效录入</title>
|
||||
<style type="text/css">
|
||||
.f-grid-row.noEdit {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.f-grid-colheader-text {
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
|
||||
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
|
||||
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="工效情况" BoxFlex="1" AllowColumnLocking="true" ForceFit="true"
|
||||
runat="server" EnableCollapse="true" DataKeyNames="Id" EnableTree="true" EnableColumnLines="true" ClicksToEdit="1" AllowCellEditing="true"
|
||||
DataIDField="Id">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
|
||||
<Items>
|
||||
<f:ToolbarFill runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="BtnAnalyse" Text="统计" Icon="ChartPie"
|
||||
runat="server" OnClick="BtnAnalyse_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" Text="保存"
|
||||
OnClick="btnSave_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:RenderField Width="50px" ColumnID="Code" DataField="Code" FieldType="String" EnableLock="true" Locked="true"
|
||||
HeaderText="序号" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="Name" DataField="Name" SortField="Name" EnableLock="true" Locked="true"
|
||||
FieldType="String" HeaderText="工种/机械" TextAlign="Left" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="60px" ColumnID="UnitOfMeasurement" DataField="UnitOfMeasurement" SortField="UnitOfMeasurement" EnableLock="true" Locked="true"
|
||||
FieldType="String" HeaderText="单位" TextAlign="Center" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="BaseWorkEfficiency" DataField="BaseWorkEfficiency" SortField="BaseWorkEfficiency" EnableLock="true" Locked="true"
|
||||
FieldType="Double" HeaderText="工效基准" TextAlign="Left" HeaderTextAlign="Center">
|
||||
<Editor>
|
||||
<f:NumberBox ID="nbBaseWorkEfficiency" NoDecimal="false" NoNegative="true" MinValue="0"
|
||||
runat="server">
|
||||
</f:NumberBox>
|
||||
</Editor>
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="AvgWorkEfficiency" DataField="AvgWorkEfficiency" FieldType="Double" EnableLock="true" Locked="true"
|
||||
HeaderText="项目当前平均工效" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="Type" DataField="Type" SortField="Type"
|
||||
FieldType="String" TextAlign="Left" HeaderTextAlign="Center" Hidden="true">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="TypeId" DataField="TypeId" SortField="TypeId"
|
||||
FieldType="String" TextAlign="Left" HeaderTextAlign="Center" Hidden="true">
|
||||
</f:RenderField>
|
||||
</Columns>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
+272
@@ -0,0 +1,272 @@
|
||||
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 ProjectConstructionLogWorkEfficiencySum : PageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 加载表头
|
||||
/// </summary>
|
||||
protected void Page_Init(object sender, EventArgs e)
|
||||
{
|
||||
InitGrid();
|
||||
}
|
||||
|
||||
#region 表头
|
||||
/// <summary>
|
||||
/// 表头
|
||||
/// </summary>
|
||||
private void InitGrid()
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var contracts = (from x in db.PHTGL_Contract
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
orderby x.ContractNum
|
||||
select x).ToList();
|
||||
GroupField gf = new GroupField();
|
||||
gf.ColumnID = "GX";
|
||||
gf.HeaderText = "工效统计";
|
||||
gf.HeaderTextAlign = TextAlign.Center;
|
||||
for (int i = 0; i < contracts.Count; i++)
|
||||
{
|
||||
RenderField rd1 = new RenderField();
|
||||
rd1.ColumnID = "Contract" + i.ToString();
|
||||
rd1.Width = Unit.Pixel(100);
|
||||
rd1.DataField = "Contract" + i.ToString();
|
||||
rd1.FieldType = FieldType.Double;
|
||||
rd1.HeaderText = contracts[i].ContractNum;
|
||||
rd1.HeaderTextAlign = TextAlign.Center;
|
||||
gf.Columns.Add(rd1);
|
||||
}
|
||||
Grid1.Columns.Add(gf);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void GetData()
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var constructionLogWorkEfficiencyMonths = from x in db.ZHGL_ConstructionLogWorkEfficiencyMonth
|
||||
join y in db.PHTGL_ContractTrack on x.ContractTrackId equals y.Id
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select new { x.TypeId, x.UnitOfMeasurement, y.ContractId, x.WorkEfficiency };
|
||||
var persons = (from x in db.ZHGL_ConstructionLogWorkEfficiencyMonth
|
||||
join y in db.Base_WorkPost on x.TypeId equals y.WorkPostId
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.Type == "Person"
|
||||
select new { y.WorkPostName, x.UnitOfMeasurement, x.TypeId }).Distinct().OrderBy(x => x.WorkPostName).ToList();
|
||||
var machines = (from x in db.ZHGL_ConstructionLogWorkEfficiencyMonth
|
||||
join y in db.Base_SpecialEquipment on x.TypeId equals y.SpecialEquipmentId
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.Type == "Machine"
|
||||
select new { y.SpecialEquipmentName, x.UnitOfMeasurement, x.TypeId }).Distinct().OrderBy(x => x.SpecialEquipmentName).ToList();
|
||||
var contracts = (from x in db.PHTGL_Contract
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
orderby x.ContractNum
|
||||
select x).ToList();
|
||||
DataTable table = new DataTable();
|
||||
table.Columns.Add(new DataColumn("Id", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Code", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Name", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("UnitOfMeasurement", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("BaseWorkEfficiency", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("AvgWorkEfficiency", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Type", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("TypeId", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract0", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract1", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract2", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract3", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract4", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract5", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract6", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract7", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract8", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract9", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract10", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract11", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract12", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract13", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract14", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract15", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract16", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract17", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract18", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract19", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract20", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract21", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract22", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract23", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract24", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract25", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract26", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract27", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract28", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract29", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract30", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract31", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract32", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract33", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract34", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract35", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract36", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract37", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract38", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract39", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Contract40", typeof(String)));
|
||||
DataRow row;
|
||||
row = table.NewRow();
|
||||
row[0] = SQLHelper.GetNewID();
|
||||
row[1] = "一";
|
||||
row[2] = "人工";
|
||||
table.Rows.Add(row);
|
||||
int a = 1;
|
||||
foreach (var person in persons)
|
||||
{
|
||||
row = table.NewRow();
|
||||
row[0] = SQLHelper.GetNewID();
|
||||
row[1] = a;
|
||||
row[2] = person.WorkPostName;
|
||||
row[3] = person.UnitOfMeasurement;
|
||||
|
||||
int b = 0;
|
||||
List<decimal> list = new List<decimal>();
|
||||
foreach (var contract in contracts)
|
||||
{
|
||||
var workEfficiencys = from x in constructionLogWorkEfficiencyMonths
|
||||
where x.TypeId == person.TypeId && x.UnitOfMeasurement == person.UnitOfMeasurement && x.ContractId == contract.ContractId && x.WorkEfficiency != null
|
||||
select x;
|
||||
if (workEfficiencys.Count() > 0)
|
||||
{
|
||||
decimal totalWorkEfficiencys = workEfficiencys.Sum(x => x.WorkEfficiency ?? 0);
|
||||
decimal d = decimal.Round(Convert.ToDecimal(totalWorkEfficiencys / Convert.ToDecimal(workEfficiencys.Count())), 2);
|
||||
row[8 + b] = d;
|
||||
list.Add(d);
|
||||
}
|
||||
b++;
|
||||
}
|
||||
if (list.Count > 0)
|
||||
{
|
||||
row[5] = decimal.Round(Convert.ToDecimal(list.Sum() / Convert.ToDecimal(list.Count)), 2);
|
||||
}
|
||||
row[6] = "Person";
|
||||
row[7] = person.TypeId;
|
||||
table.Rows.Add(row);
|
||||
a++;
|
||||
}
|
||||
row = table.NewRow();
|
||||
row[0] = SQLHelper.GetNewID();
|
||||
row[1] = "二";
|
||||
row[2] = "机械";
|
||||
table.Rows.Add(row);
|
||||
a = 1;
|
||||
foreach (var machine in machines)
|
||||
{
|
||||
row = table.NewRow();
|
||||
row[0] = SQLHelper.GetNewID();
|
||||
row[1] = a;
|
||||
row[2] = machine.SpecialEquipmentName;
|
||||
row[3] = machine.UnitOfMeasurement;
|
||||
|
||||
int b = 0;
|
||||
List<decimal> list = new List<decimal>();
|
||||
foreach (var contract in contracts)
|
||||
{
|
||||
var workEfficiencys = from x in constructionLogWorkEfficiencyMonths
|
||||
where x.TypeId == machine.TypeId && x.UnitOfMeasurement == machine.UnitOfMeasurement && x.ContractId == contract.ContractId && x.WorkEfficiency != null
|
||||
select x;
|
||||
if (workEfficiencys.Count() > 0)
|
||||
{
|
||||
decimal totalWorkEfficiencys = workEfficiencys.Sum(x => x.WorkEfficiency ?? 0);
|
||||
decimal d = decimal.Round(Convert.ToDecimal(totalWorkEfficiencys / Convert.ToDecimal(workEfficiencys.Count())), 2);
|
||||
row[8 + b] = d;
|
||||
list.Add(d);
|
||||
}
|
||||
b++;
|
||||
}
|
||||
if (list.Count > 0)
|
||||
{
|
||||
row[5] = decimal.Round(Convert.ToDecimal(list.Sum() / Convert.ToDecimal(list.Count)), 2);
|
||||
}
|
||||
row[6] = "Machine";
|
||||
row[7] = machine.TypeId;
|
||||
table.Rows.Add(row);
|
||||
a++;
|
||||
}
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
#region 统计按钮事件
|
||||
/// <summary>
|
||||
/// 统计
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void BtnAnalyse_Click(object sender, EventArgs e)
|
||||
{
|
||||
GetData();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Grid1.Rows.Count > 0)
|
||||
{
|
||||
BLL.ConstructionLogWorkEfficiencyProjectService.DeleteConstructionLogWorkEfficiencyProjectsByConstructionLogId(this.CurrUser.LoginProjectId);
|
||||
foreach (JObject mergedRow in Grid1.GetMergedData())
|
||||
{
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
int a = mergedRow.Value<int>("index");
|
||||
string type = values.Value<string>("Type");
|
||||
if (!string.IsNullOrEmpty(type))
|
||||
{
|
||||
string unitOfMeasurement = values.Value<string>("UnitOfMeasurement");
|
||||
string baseWorkEfficiency = values.Value<string>("BaseWorkEfficiency");
|
||||
string avgWorkEfficiency = values.Value<string>("AvgWorkEfficiency");
|
||||
string typeId = values.Value<string>("TypeId");
|
||||
Model.ZHGL_ConstructionLogWorkEfficiencyProject workEfficiency = new Model.ZHGL_ConstructionLogWorkEfficiencyProject();
|
||||
workEfficiency.ConstructionLogWorkEfficiencyProjectId = SQLHelper.GetNewID();
|
||||
workEfficiency.ProjectId = this.CurrUser.LoginProjectId;
|
||||
workEfficiency.Type = type;
|
||||
workEfficiency.TypeId = typeId;
|
||||
workEfficiency.UnitOfMeasurement = unitOfMeasurement;
|
||||
workEfficiency.BaseWorkEfficiency = Funs.GetNewDecimal(baseWorkEfficiency);
|
||||
workEfficiency.AvgWorkEfficiency = Funs.GetNewDecimal(avgWorkEfficiency);
|
||||
BLL.ConstructionLogWorkEfficiencyProjectService.AddConstructionLogWorkEfficiencyProject(workEfficiency);
|
||||
}
|
||||
}
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("请先统计后再保存!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
SGGL/FineUIPro.Web/PZHGL/InformationProject/ProjectConstructionLogWorkEfficiencySum.aspx.designer.cs
Generated
+87
@@ -0,0 +1,87 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.PZHGL.InformationProject {
|
||||
|
||||
|
||||
public partial class ProjectConstructionLogWorkEfficiencySum {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// BtnAnalyse 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button BtnAnalyse;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
/// <summary>
|
||||
/// nbBaseWorkEfficiency 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox nbBaseWorkEfficiency;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user