From 0fc3260083798b9ade509f8b5267cf58c4b431da Mon Sep 17 00:00:00 2001 From: gaofei1985 <181547018@qq.com> Date: Wed, 10 Jul 2024 16:05:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BLL/HSSE/SitePerson/PersonInOutService.cs | 11 +++- .../HSSE/SitePerson/WorkPostStatistic.aspx | 8 +++ .../HSSE/SitePerson/WorkPostStatistic.aspx.cs | 53 ++++++++++++++++++- .../WorkPostStatistic.aspx.designer.cs | 9 ++++ SGGL/Model/HSSE/WorkPostStatisticItem.cs | 10 ++++ 5 files changed, 88 insertions(+), 3 deletions(-) diff --git a/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs b/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs index 1e3e5e85..6031bc7e 100644 --- a/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs +++ b/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs @@ -406,7 +406,7 @@ namespace BLL /// 获取出入记录人工时 /// /// - public static List getWorkPostStatistic(List getAllPersonInOutList) + public static List getWorkPostStatistic(List getAllPersonInOutList, DateTime? startTime, DateTime? endTime, string projectId) { Model.SGGLDB db = Funs.DB; List reports = new List(); @@ -428,7 +428,14 @@ namespace BLL PersonCount = getW.Select(x => x.PersonId).Distinct().Count(), UnitWorkPostID = uitem + "|" + witem, }; - + if (witem == BLL.Const.WorkPost_Welder) + { + newWItem.EngineeringQuantity = (from x in db.HJGL_WeldJoint + join y in db.HJGL_WeldingDaily + on x.WeldingDailyId equals y.WeldingDailyId + where x.ProjectId == projectId && y.UnitId == uitem && y.WeldingDate >= startTime && y.WeldingDate <= endTime + select x.Size ?? 0).ToList().Sum(); + } reports.Add(newWItem); } } diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/WorkPostStatistic.aspx b/SGGL/FineUIPro.Web/HSSE/SitePerson/WorkPostStatistic.aspx index 1cc9a401..edd974ef 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/WorkPostStatistic.aspx +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/WorkPostStatistic.aspx @@ -60,6 +60,14 @@ + + + + + + + diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/WorkPostStatistic.aspx.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/WorkPostStatistic.aspx.cs index b6dc07e2..725c467e 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/WorkPostStatistic.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/WorkPostStatistic.aspx.cs @@ -101,7 +101,7 @@ namespace FineUIPro.Web.HSSE.SitePerson workPostId = this.drpWorkPost.SelectedValue; } - var dayReports = PersonInOutService.getWorkPostStatistic(getAllPersonInOutList); + var dayReports = PersonInOutService.getWorkPostStatistic(getAllPersonInOutList, startTime, endTime, this.ProjectId); DataTable tb = this.LINQToDataTable(dayReports); // 2.获取当前分页数据 //var table = this.GetPagedDataTable(GridNewDynamic, tb1); @@ -210,5 +210,56 @@ namespace FineUIPro.Web.HSSE.SitePerson } return workTime.ToString(); } + + /// + /// + /// + /// + protected string ConvertWorkEfficiency(object UnitWorkPostID, object EngineeringQuantity) + { + string workEfficiency = string.Empty; + int workTime = 0; + if (UnitWorkPostID != null) + { + List getUWId = Funs.GetStrListByStr(UnitWorkPostID.ToString(), '|'); + if (getUWId.Count() > 1) + { + string unitId = getUWId[0]; + string workPostId = getUWId[1]; + var getW = getAllPersonInOutList.Where(x => x.UnitId == unitId && x.WorkPostId == workPostId); + //// 出场记录 集合 + var getUnitOutList = getW.Where(x => x.IsIn == false); + //// 进场记录 集合 + var getUnitInList = getW.Where(x => x.IsIn == true); + int personWorkTime = 0; + List personIdList = new List(); + foreach (var itemOut in getUnitOutList) + { + var getMaxInTime = getUnitInList.Where(x => x.ChangeTime < itemOut.ChangeTime + && x.PersonId == itemOut.PersonId && x.ChangeTime.Value.AddDays(1) > itemOut.ChangeTime).Max(x => x.ChangeTime); + if (getMaxInTime.HasValue) + { + personWorkTime += Convert.ToInt32((itemOut.ChangeTime - getMaxInTime).Value.TotalMinutes); + } + else + { + personIdList.Add(itemOut.PersonId); + } + } + if (personIdList.Count() > 0) + { + personWorkTime += (personIdList.Distinct().Count() * 8 * 60); + } + + workTime = Convert.ToInt32(personWorkTime * 1.0 / 60); + decimal engineeringQuantity = Funs.GetNewDecimalOrZero(EngineeringQuantity.ToString()); + if (workTime > 0 && engineeringQuantity>0) + { + workEfficiency = (engineeringQuantity / workTime).ToString("0.##"); + } + } + } + return workEfficiency; + } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/WorkPostStatistic.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/WorkPostStatistic.aspx.designer.cs index 59dff13f..72aeae74 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/WorkPostStatistic.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/WorkPostStatistic.aspx.designer.cs @@ -129,6 +129,15 @@ namespace FineUIPro.Web.HSSE.SitePerson { /// protected global::System.Web.UI.WebControls.Label Label1; + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label2; + /// /// ToolbarSeparator1 控件。 /// diff --git a/SGGL/Model/HSSE/WorkPostStatisticItem.cs b/SGGL/Model/HSSE/WorkPostStatisticItem.cs index 97fa994f..708c9047 100644 --- a/SGGL/Model/HSSE/WorkPostStatisticItem.cs +++ b/SGGL/Model/HSSE/WorkPostStatisticItem.cs @@ -45,5 +45,15 @@ get; set; } + public decimal EngineeringQuantity + { + get; + set; + } + public decimal WorkEfficiency + { + get; + set; + } } } \ No newline at end of file