From 74ad432f4078a2d6dd9aa13d669d29b4cf0c31a1 Mon Sep 17 00:00:00 2001 From: dyy <18335927079@163.com> Date: Wed, 16 Sep 2020 14:37:17 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91=E8=80=83?= =?UTF-8?q?=E5=8B=A4=E8=AE=B0=E5=BD=95=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ADR_RecordController.cs | 45 +++++++++-- .../Views/ADR_Record/StatisticIndex.cshtml | 38 +++++++++ .../Views/ADR_Record/StatisticIndex.js | 81 +++++++++++++++++++ .../Learun.Application.Web.csproj | 2 + .../plugin/workflow/lr-workflow-ui.js | 1 - .../ADR_Record/ADR_RecordBLL.cs | 24 ++++++ .../ADR_Record/ADR_RecordEntity.cs | 21 +++++ .../ADR_Record/ADR_RecordIBLL.cs | 7 ++ .../ADR_Record/ADR_RecordService.cs | 66 +++++++++++++-- 9 files changed, 270 insertions(+), 15 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/StatisticIndex.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/StatisticIndex.js diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/ADR_RecordController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/ADR_RecordController.cs index 1e294acfb..cbecf78a7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/ADR_RecordController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/ADR_RecordController.cs @@ -35,7 +35,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers [HttpGet] public ActionResult Index() { - return View(); + return View(); } /// /// 表单页 @@ -44,7 +44,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers [HttpGet] public ActionResult Form() { - return View(); + return View(); } [HttpGet] @@ -65,9 +65,18 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers public ActionResult ViewerReport() { return StiMvcViewer.ViewerEventResult(); - + } + /// + /// 统计主页面 + /// + /// + [HttpGet] + public ActionResult StatisticIndex() + { + return View(); + } #endregion #region 获取数据 @@ -113,12 +122,34 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers [AjaxOnly] public ActionResult GetFormData(string keyValue) { - var ADR_RecordData = aDR_RecordIBLL.GetADR_RecordEntity( keyValue ); - var jsonData = new { + var ADR_RecordData = aDR_RecordIBLL.GetADR_RecordEntity(keyValue); + var jsonData = new + { ADR_Record = ADR_RecordData, }; return Success(jsonData); } + /// + /// 考勤记录统计 + /// + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetStatisticList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = aDR_RecordIBLL.GetStatisticList(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + #endregion #region 提交数据 @@ -147,10 +178,10 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers { UserInfo userInfo = LoginUserInfo.Get(); ADR_RecordEntity entity = strEntity.ToObject(); - aDR_RecordIBLL.SaveEntity(keyValue,entity); + aDR_RecordIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } #endregion - + } } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/StatisticIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/StatisticIndex.cshtml new file mode 100644 index 000000000..ef330b20e --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/StatisticIndex.cshtml @@ -0,0 +1,38 @@ +@{ + ViewBag.Title = "考勤记录统计"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+
+
+
+
+
+
+
职工编号
+ +
+
+
职工姓名
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+@Html.AppendJsFile("/Areas/LogisticsManagement/Views/ADR_Record/StatisticIndex.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/StatisticIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/StatisticIndex.js new file mode 100644 index 000000000..beaa54488 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/StatisticIndex.js @@ -0,0 +1,81 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2020-08-28 18:09 + * 描 述:考勤记录统计 + */ +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + var startTime; + var endTime; + var page = { + init: function () { + page.initGird(); + page.bind(); + }, + bind: function () { + // 时间搜索框 + $('#datesearch').lrdate({ + dfdata: [ + { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } } + ], + // 月 + mShow: false, + premShow: false, + // 季度 + jShow: false, + prejShow: false, + // 年 + ysShow: false, + yxShow: false, + preyShow: false, + yShow: false, + // 默认 + dfvalue: '1', + selectfn: function (begin, end) { + startTime = begin; + endTime = end; + page.search(); + } + }); + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 220, 400); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + }, + // 初始化列表 + initGird: function () { + $('#gridtable').lrAuthorizeJfGrid({ + url: top.$.rootUrl + '/LogisticsManagement/ADR_Record/GetStatisticList', + headData: [ + { label: "姓名", name: "UserName", width: 100, align: "left" }, + { label: "职工编号", name: "UserNo", width: 100, align: "left" }, + { label: "打卡时间", name: "ClockDate", width: 100, align: "left" }, + { label: "正常次数", name: "ZhengChangNum", width: 100, align: "left" }, + { label: "迟到次数", name: "ChiDaoNum", width: 100, align: "left" }, + { label: "早退次数", name: "ZaoTuiNum", width: 100, align: "left" }, + ], + mainId: '', + isPage: true, + sidx: "ClockDate desc,UserNo", + }); + }, + search: function (param) { + param = param || {}; + param.StartTime = startTime; + param.EndTime = endTime; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + $('#gridtable').jfGridSet('reload'); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index b718cafee..fd725c710 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -1141,6 +1141,7 @@ + @@ -6813,6 +6814,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/workflow/lr-workflow-ui.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/workflow/lr-workflow-ui.js index 8af1957e3..95864c2c8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/workflow/lr-workflow-ui.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/workflow/lr-workflow-ui.js @@ -808,7 +808,6 @@ path.setAttribute("stroke", "gray"); path.setAttribute("marker-end", "url(#arrow1)"); } - / line.appendChild(hi); line.appendChild(path); line.style.cursor = "crosshair"; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordBLL.cs index 36a2a8aa3..d3c9c7c11 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordBLL.cs @@ -109,6 +109,30 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } } + + /// + /// 考勤记录统计 + /// + /// 查询参数 + /// + public IEnumerable GetStatisticList(Pagination pagination, string queryJson) + { + try + { + return aDR_RecordService.GetStatisticList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs index 1ec9fc78c..6bbbf4318 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs @@ -99,6 +99,27 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } #endregion #region 扩展字段 + /// + /// 打卡时间 + /// + [NotMapped] + public string ClockDate { get; set; } + /// + /// 正常次数 + /// + [NotMapped] + public string ZhengChangNum { get; set; } + /// + /// 迟到次数 + /// + [NotMapped] + public string ChiDaoNum { get; set; } + /// + /// 早退次数 + /// + [NotMapped] + public string ZaoTuiNum { get; set; } + #endregion } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordIBLL.cs index 529a474ff..b35775734 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordIBLL.cs @@ -36,6 +36,13 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement ADR_RecordEntity GetADR_RecordEntity(string keyValue); IEnumerable GetADR_RecordEntityByEmpNo(string year, string month, string day, string empno); + + /// + /// 考勤记录统计 + /// + /// 查询参数 + /// + IEnumerable GetStatisticList(Pagination pagination, string queryJson); #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordService.cs index d5ab27951..9afd58d7c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordService.cs @@ -63,7 +63,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } if (!queryParam["Department"].IsEmpty()) { - dp.Add("Department",queryParam["Department"].ToString(), DbType.String); + dp.Add("Department", queryParam["Department"].ToString(), DbType.String); strSql.Append(" AND emp.F_DepartmentId = @Department "); } if (!queryParam["ADR_Device"].IsEmpty()) @@ -76,7 +76,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement dp.Add("ADStatus", queryParam["ADStatus"].ToString(), DbType.String); strSql.Append(" AND t.ClockStatus = @ADStatus "); } - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(),dp, pagination); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); } catch (Exception ex) { @@ -120,10 +120,10 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } if (!queryParam["Department"].IsEmpty()) { - dp.Add("Department",queryParam["Department"].ToString(), DbType.String); + dp.Add("Department", queryParam["Department"].ToString(), DbType.String); strSql.Append(" AND t.Department = @Department "); } - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(),dp); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); } catch (Exception ex) { @@ -162,6 +162,58 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + /// + /// 考勤记录统计 + /// + /// 查询参数 + /// + public IEnumerable GetStatisticList(Pagination pagination, string queryJson) + { + try + { + var basedbname = BaseRepository().getDbConnection().Database; + + var strSql = new StringBuilder(); + strSql.Append("select t.UserNo,u.F_RealName as UserName,CONVERT(varchar(100), t.ClockTime, 23) as ClockDate,sum(case when t.ClockStatus='1' then 1 else 0 end) as ZhengChangNum,sum(case when t.ClockStatus='2' then 1 else 0 end) as ChiDaoNum,sum(case when t.ClockStatus='3' then 1 else 0 end) as ZaoTuiNum "); + strSql.Append(" from ADR_Record t "); + strSql.Append(" left join " + basedbname + ".dbo.LR_Base_User u on u. F_EnCode=T.UserNo "); + strSql.Append(" where 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) + { + dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); + dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime); + strSql.Append(" AND ( t.ClockTime >= @startTime AND t.ClockTime <= @endTime ) "); + } + if (!queryParam["UserNo"].IsEmpty()) + { + dp.Add("UserNo", queryParam["UserNo"].ToString(), DbType.String); + strSql.Append(" AND t.UserNo = @UserNo "); + } + if (!queryParam["UserName"].IsEmpty()) + { + dp.Add("UserName", "%" + queryParam["UserName"].ToString() + "%", DbType.String); + strSql.Append(" AND u.F_RealName Like @UserName "); + } + strSql.Append(" group by t.UserNo,u.F_RealName,CONVERT(varchar(100), t.ClockTime, 23) "); + + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion #region 提交数据 @@ -175,7 +227,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement { try { - this.BaseRepository("CollegeMIS").Delete(t=>t.ID == keyValue); + this.BaseRepository("CollegeMIS").Delete(t => t.ID == keyValue); } catch (Exception ex) { @@ -231,11 +283,11 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// /// /// - public IEnumerable GetADR_RecordEntityByEmpNo(string year,string month,string day,string empno) + public IEnumerable GetADR_RecordEntityByEmpNo(string year, string month, string day, string empno) { try { - return this.BaseRepository("CollegeMIS").FindList(m=>m.ADYear==year&&m.ADMonth==month&&m.ADDay==day&&m.UserNo==empno); + return this.BaseRepository("CollegeMIS").FindList(m => m.ADYear == year && m.ADMonth == month && m.ADDay == day && m.UserNo == empno); } catch (Exception ex) {