@@ -6,6 +6,7 @@ using System.Web.Mvc; | |||
using Learun.Application.Base.SystemModule; | |||
using System.Collections.Generic; | |||
using System.IO; | |||
using System.Linq; | |||
namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
{ | |||
@@ -61,6 +62,16 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 明细统计主页面 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult StatisticDetailIndex() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
#region 获取数据 | |||
@@ -121,9 +132,31 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetStatisticList(string pagination, string queryJson) | |||
{ | |||
var data = aDR_RecordIBLL.GetStatisticList(null, queryJson).GroupBy(x => new { x.UserNo, x.UserName }) | |||
.Select(x => new ADR_RecordEntity() | |||
{ | |||
UserNo = x.Key.UserNo, | |||
UserName = x.Key.UserName, | |||
ZhengChangNum = x.Where(y => y.ClockStatus == "1").Count().ToString(), | |||
ChiDaoNum = x.Where(y => y.ClockStatus == "2").Count().ToString(), | |||
ZaoTuiNum = x.Where(y => y.ClockStatus == "3").Count().ToString() | |||
}).OrderBy(x => x.UserNo); | |||
return Success(data); | |||
} | |||
/// <summary> | |||
/// 考勤明细统计 | |||
/// <summary> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetStatisticDetailList(string pagination, string queryJson) | |||
{ | |||
Pagination paginationobj = pagination.ToObject<Pagination>(); | |||
var data = aDR_RecordIBLL.GetStatisticList(paginationobj, queryJson); | |||
var data = aDR_RecordIBLL.GetStatisticDetailList(paginationobj, queryJson); | |||
var jsonData = new | |||
{ | |||
rows = data, | |||
@@ -0,0 +1,45 @@ | |||
@{ | |||
ViewBag.Title = "考勤记录统计"; | |||
Layout = "~/Views/Shared/_Index.cshtml"; | |||
} | |||
<div class="lr-layout " > | |||
<div class="lr-layout-center"> | |||
<div class="lr-layout-wrap lr-layout-wrap-notitle "> | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
@*<div class="lr-layout-tool-item"> | |||
<input id="date" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd',onpicked: function () { $('#date').trigger('change'); } })" placeholder="请选择日期" /> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i> <span class="lrlt">查询</span></a> | |||
</div>*@ | |||
<div class="lr-layout-tool-item"> | |||
<div id="multiple_condition_query"> | |||
<div class="lr-query-formcontent"> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">考勤时间</div> | |||
<input id="Date" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd',onpicked: function () { $('#Date').trigger('change'); } })" placeholder="请选择日期" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">职工编号</div> | |||
<input id="UserNo" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">职工姓名</div> | |||
<input id="UserName" type="text" class="form-control" /> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-tool-right"> | |||
<div class=" btn-group btn-group-sm"> | |||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-body" id="gridtable"></div> | |||
</div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/LogisticsManagement/Views/ADR_Record/StatisticDetailIndex.js") |
@@ -0,0 +1,126 @@ | |||
/* * 版 本 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 date = ""; | |||
var page = { | |||
init: function () { | |||
page.initGird(); | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) { | |||
page.search(queryJson); | |||
}, 220, 400); | |||
//当前年 | |||
var now = learun.formatDate(new Date(), 'yyyy-MM-dd'); | |||
$('#Date').val(now); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
}); | |||
//查询 | |||
//$('#btn_Search').on('click', function () { | |||
// date = $('#date').val(); | |||
// if (date == null || date == undefined || date == "") { | |||
// learun.alert.warning("请选择查询时间!"); | |||
// return; | |||
// } | |||
// page.search(); | |||
//}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
$('#gridtable').lrAuthorizeJfGrid({ | |||
url: top.$.rootUrl + '/LogisticsManagement/ADR_Record/GetStatisticDetailList', | |||
headData: [ | |||
{ label: "姓名", name: "UserName", width: 100, align: "left" }, | |||
{ label: "职工编号", name: "UserNo", width: 100, align: "left" }, | |||
{ | |||
label: "部门", name: "Department", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata', | |||
key: value, | |||
keyId: 'id', | |||
callback: function (_data) { | |||
callback(_data['name']); | |||
} | |||
}); | |||
} | |||
}, | |||
{ label: "日期", name: "ClockDate", width: 100, align: "left" }, | |||
{ label: "班次", name: "BanCi", width: 60, align: "left" }, | |||
{ label: "时间段", name: "TimePeriod", width: 150, align: "left" }, | |||
{ | |||
label: "上班状态", name: "ADStatusWork", width: 60, align: "left", formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('dataItem', { | |||
key: value, | |||
code: 'ADStatus', | |||
callback: function (_data) { | |||
//callback(_data.text); | |||
if (_data.text) { | |||
if (_data.text == "正常") { | |||
callback('<span class=\"label label-success\">' + _data.text + '</span>'); | |||
} else if (_data.text == "缺勤") { | |||
callback('<span class=\"label label-danger\">' + _data.text + '</span>'); | |||
} else { | |||
callback('<span class=\"label label-warning\">' + _data.text + '</span>'); | |||
} | |||
} | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: "下班状态", name: "ADStatusClose", width: 60, align: "left", formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('dataItem', { | |||
key: value, | |||
code: 'ADStatus', | |||
callback: function (_data) { | |||
if (_data.text) { | |||
if (_data.text == "正常") { | |||
callback('<span class=\"label label-success\">' + _data.text + '</span>'); | |||
} else if (_data.text == "缺勤") { | |||
callback('<span class=\"label label-danger\">' + _data.text + '</span>'); | |||
} else { | |||
callback('<span class=\"label label-warning\">' + _data.text + '</span>'); | |||
} | |||
} | |||
} | |||
}); | |||
} | |||
}, | |||
{ label: "签到时间", name: "ClockTimeWork", width: 80, align: "left" }, | |||
{ label: "签退时间", name: "ClockTimeClose", width: 80, align: "left" }, | |||
{ label: "迟到(分钟)", name: "ChidaoMinutes", width: 80, align: "left" }, | |||
{ label: "早退(分钟)", name: "ZaoTuiMinutes", width: 80, align: "left" }, | |||
{ label: "出勤(分钟)", name: "ChuQinMinutes", width: 80, align: "left" }, | |||
{ label: "缺勤(分钟)", name: "QueQinMinutes", width: 80, align: "left" }, | |||
{ label: "工作(分钟)", name: "WorkMinutes", width: 80, align: "left" }, | |||
{ label: "休息(分钟)", name: "RestMinutes", width: 80, align: "left" }, | |||
], | |||
mainId: '', | |||
isPage: true, | |||
sidx: 'UserNo,UserName,ClockTime' | |||
}); | |||
page.search(); | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
//param.Date = date; | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
refreshGirdData = function () { | |||
$('#gridtable').jfGridSet('reload'); | |||
}; | |||
page.init(); | |||
} |
@@ -57,14 +57,14 @@ var bootstrap = function ($, learun) { | |||
headData: [ | |||
{ label: "姓名", name: "UserName", width: 100, align: "left" }, | |||
{ label: "职工编号", name: "UserNo", width: 100, align: "left" }, | |||
{ label: "打卡时间", name: "ClockDate", 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", | |||
isPage: false, | |||
sidx: "UserNo" | |||
}); | |||
}, | |||
search: function (param) { | |||
@@ -1117,6 +1117,7 @@ | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\Allocation.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\DormitoryAdd.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\ADR_Record\AttendanceReportByWeek.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\ADR_Record\StatisticDetailIndex.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\ADR_Record\StatisticIndex.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\APAppointmentPsychologist\Form.js" /> | |||
<Content Include="Areas\LogisticsManagement\Views\APAppointmentPsychologist\Index.js" /> | |||
@@ -6792,6 +6793,7 @@ | |||
<Content Include="Areas\LogisticsManagement\Views\ADR_Record\Report.mrt" /> | |||
<Content Include="Areas\EducationalAdministration\Views\EADateArrange\InitByConditionForm.cshtml" /> | |||
<Content Include="Areas\LogisticsManagement\Views\ADR_Record\StatisticIndex.cshtml" /> | |||
<Content Include="Areas\LogisticsManagement\Views\ADR_Record\StatisticDetailIndex.cshtml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile1.pubxml" /> | |||
@@ -133,6 +133,30 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 考勤明细统计 | |||
/// <summary> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<ADR_RecordEntity> GetStatisticDetailList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
return aDR_RecordService.GetStatisticDetailList(pagination, queryJson); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -50,7 +50,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
[Column("CLOCKTIME")] | |||
public DateTime? ClockTime { get; set; } | |||
/// <summary> | |||
/// 打卡结果 1正常,2迟到,3早退,4上班补签,5下班补签 | |||
/// 打卡结果 1正常,2迟到,3早退,4上班补签,5下班补签,6缺勤 | |||
/// </summary> | |||
[Column("CLOCKSTATUS")] | |||
public string ClockStatus { get; set; } | |||
@@ -119,7 +119,71 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
/// </summary> | |||
[NotMapped] | |||
public string ZaoTuiNum { get; set; } | |||
/// <summary> | |||
/// 班次 如:上下班 | |||
/// </summary> | |||
[NotMapped] | |||
public string BanCi { get; set; } | |||
/// <summary> | |||
/// 时间段 如:上午上下班(08:05:00-11:24:00) | |||
/// </summary> | |||
[NotMapped] | |||
public string TimePeriod { get; set; } | |||
/// <summary> | |||
/// 时间段标识 1上午,2下午 | |||
/// </summary> | |||
[NotMapped] | |||
public int TimePeriodNo { get; set; } | |||
/// <summary> | |||
/// 上班状态 | |||
/// </summary> | |||
[NotMapped] | |||
public string ADStatusWork { get; set; } | |||
/// <summary> | |||
/// 下班状态 | |||
/// </summary> | |||
[NotMapped] | |||
public string ADStatusClose { get; set; } | |||
/// <summary> | |||
/// 签到时间 | |||
/// </summary> | |||
[NotMapped] | |||
public string ClockTimeWork { get; set; } | |||
/// <summary> | |||
/// 签退时间 | |||
/// </summary> | |||
[NotMapped] | |||
public string ClockTimeClose { get; set; } | |||
/// <summary> | |||
/// 迟到 | |||
/// </summary> | |||
[NotMapped] | |||
public int ChidaoMinutes { get; set; } | |||
/// <summary> | |||
/// 早退 | |||
/// </summary> | |||
[NotMapped] | |||
public int ZaoTuiMinutes { get; set; } | |||
/// <summary> | |||
/// 出勤 | |||
/// </summary> | |||
[NotMapped] | |||
public int ChuQinMinutes { get; set; } | |||
/// <summary> | |||
/// 缺勤 | |||
/// </summary> | |||
[NotMapped] | |||
public int QueQinMinutes { get; set; } | |||
/// <summary> | |||
/// 工作 | |||
/// </summary> | |||
[NotMapped] | |||
public int WorkMinutes { get; set; } | |||
/// <summary> | |||
/// 休息 | |||
/// </summary> | |||
[NotMapped] | |||
public int RestMinutes { get; set; } | |||
#endregion | |||
} | |||
} | |||
@@ -43,6 +43,13 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
IEnumerable<ADR_RecordEntity> GetStatisticList(Pagination pagination, string queryJson); | |||
/// <summary> | |||
/// 考勤明细统计 | |||
/// <summary> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
IEnumerable<ADR_RecordEntity> GetStatisticDetailList(Pagination pagination, string queryJson); | |||
#endregion | |||
#region 提交数据 | |||
@@ -1,9 +1,11 @@ | |||
using Dapper; | |||
using Learun.Application.TwoDevelopment.PersonnelManagement; | |||
using Learun.DataBase.Repository; | |||
using Learun.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Linq; | |||
using System.Text; | |||
namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
@@ -141,7 +143,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
} | |||
strSql.Append(" order by t.UserNo,c.F_SortCode,t.ClockTime "); | |||
return this.BaseRepository("CollegeMIS").FindList<ADR_RecordEntity>(strSql.ToString(),dp); | |||
return this.BaseRepository("CollegeMIS").FindList<ADR_RecordEntity>(strSql.ToString(), dp); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -192,9 +194,9 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
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("select t.ID,t.UserNo,t.ClockStatus,u.F_RealName as UserName "); | |||
strSql.Append(" from ADR_Record t "); | |||
strSql.Append(" left join " + basedbname + ".dbo.LR_Base_User u on u. F_EnCode=T.UserNo "); | |||
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(); | |||
// 虚拟参数 | |||
@@ -215,9 +217,134 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
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<ADR_RecordEntity>(strSql.ToString(), dp, pagination); | |||
return this.BaseRepository("CollegeMIS").FindList<ADR_RecordEntity>(strSql.ToString(), dp); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 考勤明细统计 | |||
/// <summary> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<ADR_RecordEntity> GetStatisticDetailList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
var basedbname = BaseRepository().getDbConnection().Database; | |||
var queryParam = queryJson.ToJObject(); | |||
var date = DateTime.Now.ToDateString(); | |||
if (!queryParam["Date"].IsEmpty()) | |||
{ | |||
date = queryParam["Date"].ToDate().ToDateString(); | |||
} | |||
var strSql = new StringBuilder(); | |||
strSql.Append("select u.F_Encode as UserNo,u.F_RealName as UserName,u.F_DepartmentId as Department,t.ID,t.ADType,t.ADTime,t.ClockTime,t.ClockStatus "); | |||
strSql.Append(" from " + basedbname + ".dbo.LR_Base_User u "); | |||
strSql.Append(" left join ADR_Record t on u.F_EnCode=t.UserNo and t.ADYear='" + date.Substring(0, 4) + "' and t.ADMonth='" + date.Substring(5, 2) + "' and t.ADDay='" + date.Substring(8, 2) + "' "); | |||
strSql.Append(" where u.F_Description='教师' AND u.F_DeleteMark = 0 AND u.F_EnabledMark = 1 and u.F_Encode is not null "); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
if (!queryParam["UserNo"].IsEmpty()) | |||
{ | |||
dp.Add("UserNo", queryParam["UserNo"].ToString(), DbType.String); | |||
strSql.Append(" AND u.F_EnCode = @UserNo "); | |||
} | |||
if (!queryParam["UserName"].IsEmpty()) | |||
{ | |||
dp.Add("UserName", "%" + queryParam["UserName"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND u.F_RealName Like @UserName "); | |||
} | |||
//某天记录列表 | |||
var data = this.BaseRepository("CollegeMIS").FindList<ADR_RecordEntity>(strSql.ToString(), dp, pagination) | |||
.GroupBy(x => new { x.UserNo, x.UserName, x.Department }).Select(x => new | |||
{ | |||
UserNo = x.Key.UserNo, | |||
UserName = x.Key.UserName, | |||
Department = x.Key.Department, | |||
Group = x.Select(y => new ADR_RecordEntity() | |||
{ | |||
ADType = y.ADType, | |||
ClockTime = y.ClockTime, | |||
ClockStatus = y.ClockStatus | |||
}) | |||
}); | |||
//启用的考勤规则 | |||
var restrictionEntity = this.BaseRepository("CollegeMIS").FindEntity<ADR_RestrictionEntity>(m => m.REnable == true); | |||
var WorkTimeTemp = string.Format("{0} {1}", date, restrictionEntity?.WorkTime).ToDate(); | |||
var NoonCloseTimeTemp = string.Format("{0} {1}", date, restrictionEntity?.NoonCloseTime).ToDate(); | |||
var NoonWorkTimeTemp = string.Format("{0} {1}", date, restrictionEntity?.NoonWorkTime).ToDate(); | |||
var CloseTimeTemp = string.Format("{0} {1}", date, restrictionEntity?.CloseTime).ToDate(); | |||
var MorningMinutes = (NoonCloseTimeTemp - WorkTimeTemp).TotalMinutes.ToInt();//上午应工作分钟数 | |||
var AfternoonMinutes = (CloseTimeTemp - NoonWorkTimeTemp).TotalMinutes.ToInt();//下午应工作分钟数 | |||
//结果列表 | |||
var result = new List<ADR_RecordEntity>(); | |||
foreach (var item in data) | |||
{ | |||
var adtype1 = item.Group.FirstOrDefault(x => x.ADType == "1"); | |||
var adtype8 = item.Group.FirstOrDefault(x => x.ADType == "8"); | |||
var adtype7 = item.Group.FirstOrDefault(x => x.ADType == "7"); | |||
var adtype2 = item.Group.FirstOrDefault(x => x.ADType == "2"); | |||
//上午 | |||
var morning = new ADR_RecordEntity() | |||
{ | |||
UserNo = item.UserNo, | |||
UserName = item.UserName, | |||
Department = item.Department, | |||
ClockDate = date, | |||
BanCi = "上下班", | |||
TimePeriodNo = 1, | |||
TimePeriod = string.Format("上午上下班({0}-{1})", restrictionEntity?.WorkTime, restrictionEntity?.NoonCloseTime), | |||
ADStatusWork = adtype1 != null ? adtype1.ClockStatus : "6", | |||
ADStatusClose = adtype8 != null ? adtype8.ClockStatus : "6", | |||
ClockTimeWork = adtype1 != null ? adtype1.ClockTime.ToTimeString() : "-", | |||
ClockTimeClose = adtype8 != null ? adtype8.ClockTime.ToTimeString() : "-", | |||
ChidaoMinutes = adtype1 != null ? adtype1.ClockStatus == "2" ? (adtype1.ClockTime.Value - WorkTimeTemp).TotalMinutes.ToInt() : 0 : 0, | |||
ZaoTuiMinutes = adtype8 != null ? adtype8.ClockStatus == "3" ? (NoonCloseTimeTemp - adtype8.ClockTime.Value).TotalMinutes.ToInt() : 0 : 0, | |||
ChuQinMinutes = adtype1 != null && adtype8 != null ? (adtype8.ClockTime.Value - adtype1.ClockTime.Value).TotalMinutes.ToInt() : 0, | |||
QueQinMinutes = adtype1 != null && adtype8 != null ? 0 : MorningMinutes, | |||
RestMinutes = 0 | |||
}; | |||
morning.WorkMinutes = MorningMinutes == morning.QueQinMinutes ? 0 : MorningMinutes - morning.ChidaoMinutes - morning.ZaoTuiMinutes - morning.QueQinMinutes; | |||
result.Add(morning); | |||
//下午 | |||
var afternoon = new ADR_RecordEntity() | |||
{ | |||
UserNo = item.UserNo, | |||
UserName = item.UserName, | |||
Department = item.Department, | |||
ClockDate = date, | |||
BanCi = "上下班", | |||
TimePeriodNo = 2, | |||
TimePeriod = string.Format("下午上下班({0}-{1})", restrictionEntity?.NoonWorkTime, restrictionEntity?.CloseTime), | |||
ADStatusWork = adtype7 != null ? adtype7.ClockStatus : "6", | |||
ADStatusClose = adtype2 != null ? adtype2.ClockStatus : "6", | |||
ClockTimeWork = adtype7 != null ? adtype7.ClockTime.ToTimeString() : "-", | |||
ClockTimeClose = adtype2 != null ? adtype2.ClockTime.ToTimeString() : "-", | |||
ChidaoMinutes = adtype7 != null ? adtype7.ClockStatus == "2" ? (adtype7.ClockTime.Value - NoonWorkTimeTemp).TotalMinutes.ToInt() : 0 : 0, | |||
ZaoTuiMinutes = adtype2 != null ? adtype2.ClockStatus == "3" ? (CloseTimeTemp - adtype2.ClockTime.Value).TotalMinutes.ToInt() : 0 : 0, | |||
ChuQinMinutes = adtype7 != null && adtype2 != null ? (adtype2.ClockTime.Value - adtype7.ClockTime.Value).TotalMinutes.ToInt() : 0, | |||
QueQinMinutes = adtype7 != null && adtype2 != null ? 0 : AfternoonMinutes, | |||
RestMinutes = 0 | |||
}; | |||
afternoon.WorkMinutes = AfternoonMinutes == afternoon.QueQinMinutes ? 0 : AfternoonMinutes - afternoon.ChidaoMinutes - afternoon.ZaoTuiMinutes - afternoon.QueQinMinutes; | |||
result.Add(afternoon); | |||
} | |||
return result.OrderBy(x => x.UserNo).ThenBy(x => x.UserName).ThenBy(x => x.TimePeriodNo); | |||
} | |||
catch (Exception ex) | |||
{ | |||