Browse Source

Merge branch '黑龙江艺术高中职' of http://123.57.209.16:3000/bjquanjiang/DigitalScholl into 黑龙江艺术高中职

黑艺新账号
ndbs 1 year ago
parent
commit
21403c0964
9 changed files with 269 additions and 197 deletions
  1. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.js
  2. +7
    -7
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachAttendance/StatisticDetailIndex.cshtml
  3. +32
    -13
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachAttendance/StatisticDetailIndex.js
  4. +9
    -8
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/StatisticDetailIndex.cshtml
  5. +33
    -14
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/StatisticDetailIndex.js
  6. +2
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  7. +13
    -8
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachAttendance/TeachAttendanceService.cs
  8. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs
  9. +171
    -145
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordService.cs

+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.js View File

@@ -18,7 +18,7 @@ var bootstrap = function ($, learun) {
bind: function () {
// 时间搜索框
$('#weeks').lrselect({
data: [{ text: "3周", value: "3" }, { text: "4周", value: "4" }],
data: [{ text: "1周", value: "1" },{ text: "2周", value: "2" },{ text: "3周", value: "3" }, { text: "4周", value: "4" }],
text: "text",
value: "value",
})


+ 7
- 7
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachAttendance/StatisticDetailIndex.cshtml View File

@@ -2,23 +2,23 @@
ViewBag.Title = "授课考勤明细统计";
Layout = "~/Views/Shared/_Index.cshtml";
}
<style>
.lr-search-date{
width:100%;
}
</style>
<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>&nbsp;<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="请选择日期" />
@*<input id="Date" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd',onpicked: function () { $('#Date').trigger('change'); } })" placeholder="请选择日期" />*@
<div id="datesearch"></div>
</div>
<div class="col-xs-12 lr-form-item">
<div class="lr-form-item-title">职工编号</div>


+ 32
- 13
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachAttendance/StatisticDetailIndex.js View File

@@ -7,7 +7,8 @@
var refreshGirdData;
var bootstrap = function ($, learun) {
"use strict";
//var date = "";
var startTime;
var endTime;
var page = {
init: function () {
page.initGird();
@@ -17,22 +18,39 @@ var bootstrap = function ($, learun) {
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
page.search(queryJson);
}, 250, 400);
// 时间搜索框
$('#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: '0',
selectfn: function (begin, end) {
startTime = begin;
endTime = end;
}
});
//当前年
var now = learun.formatDate(new Date(), 'yyyy-MM-dd');
$('#Date').val(now);
//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();
//});
// 部门选择
$('#F_DepartmentId').lrselect({
type: 'tree',
@@ -135,7 +153,8 @@ var bootstrap = function ($, learun) {
},
search: function (param) {
param = param || {};
//param.Date = date;
param.startTime = startTime;
param.endTime = endTime;
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
}
};


+ 9
- 8
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/StatisticDetailIndex.cshtml View File

@@ -2,23 +2,24 @@
ViewBag.Title = "考勤记录统计";
Layout = "~/Views/Shared/_Index.cshtml";
}
<div class="lr-layout " >

<style>
.lr-search-date {
width: 100%;
}
</style>
<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>&nbsp;<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="请选择日期" />
@*<input id="Date" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd',onpicked: function () { $('#Date').trigger('change'); } })" placeholder="请选择日期" />*@
<div id="datesearch"></div>
</div>
<div class="col-xs-12 lr-form-item">
<div class="lr-form-item-title">职工编号</div>


+ 33
- 14
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/StatisticDetailIndex.js View File

@@ -7,7 +7,8 @@
var refreshGirdData;
var bootstrap = function ($, learun) {
"use strict";
//var date = "";
var startTime;
var endTime;
var page = {
init: function () {
page.initGird();
@@ -17,22 +18,39 @@ var bootstrap = function ($, learun) {
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
page.search(queryJson);
}, 250, 400);
// 时间搜索框
$('#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: '0',
selectfn: function (begin, end) {
startTime = begin;
endTime = end;
}
});
//当前年
var now = learun.formatDate(new Date(), 'yyyy-MM-dd');
$('#Date').val(now);
//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();
//});
// 部门选择
$('#F_DepartmentId').lrselect({
type: 'tree',
@@ -121,13 +139,14 @@ var bootstrap = function ($, learun) {
],
mainId: '',
isPage: true,
sidx: 'UserNo,UserName,ClockTime'
sidx: ''
});
page.search();
},
search: function (param) {
param = param || {};
//param.Date = date;
param.startTime = startTime;
param.endTime = endTime;
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
}
};


+ 2
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj View File

@@ -3447,12 +3447,14 @@
<Content Include="Content\js\easing.js" />
<Content Include="Content\js\echarts.js" />
<Content Include="Content\js\echarts.min.js" />
<Content Include="Content\js\FileSaver.js" />
<Content Include="Content\js\gl.js" />
<Content Include="Content\js\index.js" />
<Content Include="Content\js\indexTwo.js" />
<Content Include="Content\js\jquery-ui.min.js" />
<Content Include="Content\js\jquery.js" />
<Content Include="Content\js\jquery.min.js" />
<Content Include="Content\js\jquery.wordexport.js" />
<Content Include="Content\js\mainTwo.js" />
<Content Include="Content\js\map.js" />
<Content Include="Content\js\mapJs\anhui.js" />


+ 13
- 8
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachAttendance/TeachAttendanceService.cs View File

@@ -124,24 +124,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
try
{
var queryParam = queryJson.ToJObject();
var date = DateTime.Now.ToDateString();
if (!queryParam["Date"].IsEmpty())
var datest = DateTime.Now.ToDateString();
var dateet = datest;
if (!queryParam["startTime"].IsEmpty())
{
date = queryParam["Date"].ToDate().ToDateString();
datest = queryParam["startTime"].ToDate().ToDateString();
}
if (!queryParam["endTime"].IsEmpty())
{
dateet = queryParam["endTime"].ToDate().ToDateString();
}
var strSql1 = $@"select a.ALTId as ALTIdInArrange,a.LessonDate,a.AcademicYearNo,a.Semester, a.LessonNo, a.LessonName, a.EmpNo as EmpNoInArrange, a.EmpName as EmpNameInArrange,a.ClassroomNo,a.LessonTime,
a.StartTime, a.EndTime,a.LessonSortNo as LessonSortNoInArrange,e.F_DepartmentId,t.*
from ArrangeLessonTerm a
left join Teach_Attendance t on a.ALTId=t.ALTId and t.LessonSortNo='1'
left join EmpInfo e on a.EmpNo=e.EmpNo
where a.LessonDate ='{date}'";
where a.LessonDate >='{datest}' and a.LessonDate <= '{dateet}'";
var strSql2 = $@"select a.Id as ALTIdInArrange,a.LessonDate,a.AcademicYearNo, a.Semester, a.LessonNo, a.LessonName,a.EmpNo as EmpNoInArrange, a.EmpName as EmpNameInArrange,a.ClassRoomNo as ClassroomNo,a.LessonSection as LessonTime,
case when LEN(a.LessonTime)>0 then SUBSTRING(a.LessonTime,1,CHARINDEX('-',a.LessonTime)-1) else '' end as StartTime,
case when LEN(a.LessonTime)>0 then SUBSTRING(a.LessonTime,CHARINDEX('-',a.LessonTime)+1,LEN(a.LessonTime)-CHARINDEX('-',a.LessonTime)) else '' end as EndTime,
a.LessonSortNo as LessonSortNoInArrange,e.F_DepartmentId,t.* from ArrangeLessonTermOfElective a
left join Teach_Attendance t on a.Id=t.ALTId and t.LessonSortNo='2'
left join EmpInfo e on a.EmpNo=e.EmpNo
where a.LessonDate='{date}'";
where a.LessonDate >='{datest}' and a.LessonDate <= '{dateet}'";
// 虚拟参数
var dp = new DynamicParameters(new { });
if (!queryParam["EmpNo"].IsEmpty())
@@ -220,15 +225,15 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
ClockTime = y.ClockTime,
ClockStatus = y.ClockStatus
}).ToList()
}).OrderBy(x => x.EmpNoInArrange).OrderBy(x => Convert.ToInt32(x.LessonTime.Substring(1)));
}).OrderBy(x => x.LessonDate).ThenBy(x => Convert.ToInt32(x.LessonTime.Substring(1)));
//结果列表
var result = new List<Teach_attendanceEntity>();
foreach (var item in data)
{
//上课时间
var WorkTimeTemp = string.Format("{0} {1}", date, item.StartTime).ToDate();
var WorkTimeTemp = string.Format("{0} {1}", item.LessonDate, item.StartTime).ToDate();
//下课时间
var CloseTimeTemp = string.Format("{0} {1}", date, item.EndTime).ToDate();
var CloseTimeTemp = string.Format("{0} {1}", item.LessonDate, item.EndTime).ToDate();
//课程应工作分钟数
var WholeMinutes = (CloseTimeTemp - WorkTimeTemp).TotalMinutes.ToInt();
//上课


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs View File

@@ -120,7 +120,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
#endregion
#region 扩展字段
/// <summary>
/// 打卡时间
/// 打卡时间(年月日)
/// </summary>
[NotMapped]
public string ClockDate { get; set; }


+ 171
- 145
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordService.cs View File

@@ -246,175 +246,201 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
{
var basedbname = BaseRepository().getDbConnection().Database;
var queryParam = queryJson.ToJObject();
var date = DateTime.Now.ToDateString();
if (!queryParam["Date"].IsEmpty())
var datest = DateTime.Now.ToDateString();
var dateet = datest;
if (!queryParam["startTime"].IsEmpty())
{
date = queryParam["Date"].ToDate().ToDateString();
datest = queryParam["startTime"].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(" inner join EmpInfo emp on u.F_EnCode=emp.EmpNo ");
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 UserNoPrev = Config.GetValue("ADR_RecordUserNoPrev");
if (!string.IsNullOrEmpty(UserNoPrev))
{
strSql.Append(" and u.F_encode like '" + UserNoPrev + "%' ");
}
// 虚拟参数
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 ");
}
if (!queryParam["F_DepartmentId"].IsEmpty())
if (!queryParam["endTime"].IsEmpty())
{
dp.Add("F_DepartmentId", queryParam["F_DepartmentId"].ToString(), DbType.String);
strSql.Append(" AND emp.F_DepartmentId = @F_DepartmentId ");
dateet = queryParam["endTime"].ToDate().ToDateString();
}
if (!queryParam["ClockStatus"].IsEmpty())
{
dp.Add("ClockStatus", queryParam["ClockStatus"].ToString(), DbType.String);
if (queryParam["ClockStatus"].ToString() == "6" || queryParam["ClockStatus"].ToString() == "0")//缺勤、旷工
//考勤时间段查询结果
var totalResult = new List<ADR_RecordEntity>();
//启用的考勤规则
var restrictionEntity = this.BaseRepository("CollegeMIS").FindEntity<ADR_RestrictionEntity>(m => m.REnable == true);
if (restrictionEntity == null)
{
return totalResult;
}
//考勤时间段查询语句
var totalSql = new StringBuilder();
totalSql.Append("select top 100 percent * from ( ");
//考勤时间段查询
for (int i = 0; i < (dateet.ToDate() - datest.ToDate()).Days + 1; i++)
{
//当天日期
var date = datest.ToDate().AddDays(i).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,'{date}' as ClockDate ");
strSql.Append(" from " + basedbname + ".dbo.LR_Base_User u ");
strSql.Append(" inner join EmpInfo emp on u.F_EnCode=emp.EmpNo ");
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 UserNoPrev = Config.GetValue("ADR_RecordUserNoPrev");
if (!string.IsNullOrEmpty(UserNoPrev))
{
strSql.Append(" AND t.ClockStatus is null ");
strSql.Append(" and u.F_encode like '" + UserNoPrev + "%' ");
}
else
// 虚拟参数
if (!queryParam["UserNo"].IsEmpty())
{
strSql.Append(" AND t.ClockStatus = @ClockStatus ");
strSql.Append($" AND u.F_EnCode = '{queryParam["UserNo"].ToString()}' ");
}
}
//某天记录列表
var data = this.BaseRepository("CollegeMIS").FindList<ADR_RecordEntity>(strSql.ToString(), dp, pagination)
.GroupBy(x => new { x.UserNo, x.UserName, x.Department }).Select(x => new
if (!queryParam["UserName"].IsEmpty())
{
strSql.Append($" AND u.F_RealName Like '%{queryParam["UserName"].ToString()}%' ");
}
if (!queryParam["F_DepartmentId"].IsEmpty())
{
strSql.Append($" AND emp.F_DepartmentId = '{queryParam["F_DepartmentId"].ToString()}' ");
}
if (!queryParam["ClockStatus"].IsEmpty())
{
UserNo = x.Key.UserNo,
UserName = x.Key.UserName,
Department = x.Key.Department,
Group = x.Select(y => new ADR_RecordEntity()
if (queryParam["ClockStatus"].ToString() == "6" || queryParam["ClockStatus"].ToString() == "0")//缺勤、旷工
{
ADType = y.ADType,
ClockTime = y.ClockTime,
ClockStatus = y.ClockStatus
})
});
//结果列表
var result = new List<ADR_RecordEntity>();
//启用的考勤规则
var restrictionEntity = this.BaseRepository("CollegeMIS").FindEntity<ADR_RestrictionEntity>(m => m.REnable == true);
if (restrictionEntity != null)
{
//上班时间
var WorkTimeTemp = string.Format("{0} {1}", date, restrictionEntity.WorkTime).ToDate();
//下班时间
var CloseTimeTemp = string.Format("{0} {1}", date, restrictionEntity.CloseTime).ToDate();
if (restrictionEntity.ClockTime == "二次打卡")
strSql.Append(" AND t.ClockStatus is null ");
}
else
{
strSql.Append($" AND t.ClockStatus = '{queryParam["ClockStatus"].ToString()}' ");
}
}
totalSql.Append(strSql);
if (i < (dateet.ToDate() - datest.ToDate()).Days)
{
totalSql.Append(" union ");
}
}
totalSql.Append(" ) as bb where 1=1 order by bb.ClockDate");
//当天记录列表
var data = this.BaseRepository("CollegeMIS").FindList<ADR_RecordEntity>(totalSql.ToString(), pagination)
.GroupBy(x => new { x.UserNo, x.UserName, x.Department, x.ClockDate }).Select(x => new
{
UserNo = x.Key.UserNo,
UserName = x.Key.UserName,
Department = x.Key.Department,
ClockDate = x.Key.ClockDate,
Group = x.Select(y => new ADR_RecordEntity()
{
ADType = y.ADType,
ClockTime = y.ClockTime,
ClockStatus = y.ClockStatus
})
});
if (restrictionEntity.ClockTime == "二次打卡")
{
#region 二次打卡

foreach (var item in data)
{
#region 二次打卡
//上班时间
var WorkTimeTemp = string.Format("{0} {1}", item.ClockDate, restrictionEntity.WorkTime).ToDate();
//下班时间
var CloseTimeTemp = string.Format("{0} {1}", item.ClockDate, restrictionEntity.CloseTime).ToDate();
var WholeMinutes = (CloseTimeTemp - WorkTimeTemp).TotalMinutes.ToInt();//全天应工作分钟数

foreach (var item in data)
var adtype1 = item.Group.FirstOrDefault(x => x.ADType == "1");//上班
var adtype2 = item.Group.FirstOrDefault(x => x.ADType == "2");//下班
//全天
var whole = new ADR_RecordEntity()
{
var adtype1 = item.Group.FirstOrDefault(x => x.ADType == "1");//上班
var adtype2 = item.Group.FirstOrDefault(x => x.ADType == "2");//下班
//全天
var whole = new ADR_RecordEntity()
{
UserNo = item.UserNo,
UserName = item.UserName,
Department = item.Department,
ClockDate = date,
BanCi = "上下班",
TimePeriodNo = 0,
TimePeriod = string.Format("上下班({0}-{1})", restrictionEntity.WorkTime, restrictionEntity.CloseTime),
ADStatusWork = adtype1 != null ? adtype1.ClockStatus : "6",
ADStatusClose = adtype2 != null ? adtype2.ClockStatus : "6",
ClockTimeWork = adtype1 != null ? adtype1.ClockTime.ToTimeString() : "-",
ClockTimeClose = adtype2 != null ? adtype2.ClockTime.ToTimeString() : "-",
ChidaoMinutes = adtype1 != null ? adtype1.ClockStatus == "2" ? (adtype1.ClockTime.Value - WorkTimeTemp).TotalMinutes.ToInt() : 0 : 0,
ZaoTuiMinutes = adtype2 != null ? adtype2.ClockStatus == "3" ? (CloseTimeTemp - adtype2.ClockTime.Value).TotalMinutes.ToInt() : 0 : 0,
ChuQinMinutes = adtype1 != null && adtype2 != null ? (adtype2.ClockTime.Value - adtype1.ClockTime.Value).TotalMinutes.ToInt() : 0,
QueQinMinutes = adtype1 != null && adtype2 != null ? 0 : WholeMinutes,
RestMinutes = 0
};
whole.WorkMinutes = WholeMinutes == whole.QueQinMinutes ? 0 : WholeMinutes - whole.ChidaoMinutes - whole.ZaoTuiMinutes - whole.QueQinMinutes;
result.Add(whole);
}
#endregion
UserNo = item.UserNo,
UserName = item.UserName,
Department = item.Department,
ClockDate = item.ClockDate,
BanCi = "上下班",
TimePeriodNo = 0,
TimePeriod = string.Format("上下班({0}-{1})", restrictionEntity.WorkTime, restrictionEntity.CloseTime),
ADStatusWork = adtype1 != null ? adtype1.ClockStatus : "6",
ADStatusClose = adtype2 != null ? adtype2.ClockStatus : "6",
ClockTimeWork = adtype1 != null ? adtype1.ClockTime.ToTimeString() : "-",
ClockTimeClose = adtype2 != null ? adtype2.ClockTime.ToTimeString() : "-",
ChidaoMinutes = adtype1 != null ? adtype1.ClockStatus == "2" ? (adtype1.ClockTime.Value - WorkTimeTemp).TotalMinutes.ToInt() : 0 : 0,
ZaoTuiMinutes = adtype2 != null ? adtype2.ClockStatus == "3" ? (CloseTimeTemp - adtype2.ClockTime.Value).TotalMinutes.ToInt() : 0 : 0,
ChuQinMinutes = adtype1 != null && adtype2 != null ? (adtype2.ClockTime.Value - adtype1.ClockTime.Value).TotalMinutes.ToInt() : 0,
QueQinMinutes = adtype1 != null && adtype2 != null ? 0 : WholeMinutes,
RestMinutes = 0
};
whole.WorkMinutes = WholeMinutes == whole.QueQinMinutes ? 0 : WholeMinutes - whole.ChidaoMinutes - whole.ZaoTuiMinutes - whole.QueQinMinutes;
totalResult.Add(whole);
}
else
#endregion
}
else
{
#region 四次打卡

foreach (var item in data)
{
#region 四次打卡
//上班时间
var WorkTimeTemp = string.Format("{0} {1}", item.ClockDate, restrictionEntity.WorkTime).ToDate();
//下班时间
var CloseTimeTemp = string.Format("{0} {1}", item.ClockDate, restrictionEntity.CloseTime).ToDate();
//中午下班时间
var NoonCloseTimeTemp = string.Format("{0} {1}", date, restrictionEntity?.NoonCloseTime).ToDate();
var NoonCloseTimeTemp = string.Format("{0} {1}", item.ClockDate, restrictionEntity?.NoonCloseTime).ToDate();
//中午上班时间
var NoonWorkTimeTemp = string.Format("{0} {1}", date, restrictionEntity?.NoonWorkTime).ToDate();
var NoonWorkTimeTemp = string.Format("{0} {1}", item.ClockDate, restrictionEntity?.NoonWorkTime).ToDate();
var MorningMinutes = (NoonCloseTimeTemp - WorkTimeTemp).TotalMinutes.ToInt();//上午应工作分钟数
var AfternoonMinutes = (CloseTimeTemp - NoonWorkTimeTemp).TotalMinutes.ToInt();//下午应工作分钟数

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()
{
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);
}
#endregion
UserNo = item.UserNo,
UserName = item.UserName,
Department = item.Department,
ClockDate = item.ClockDate,
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;
totalResult.Add(morning);
//下午
var afternoon = new ADR_RecordEntity()
{
UserNo = item.UserNo,
UserName = item.UserName,
Department = item.Department,
ClockDate = item.ClockDate,
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;
totalResult.Add(afternoon);
}
#endregion
}
return result.OrderBy(x => x.UserNo).ThenBy(x => x.UserName).ThenBy(x => x.TimePeriodNo);

return totalResult.OrderBy(x => x.ClockDate).ThenBy(x => x.UserNo).ThenBy(x => x.TimePeriodNo);
}
catch (Exception ex)
{


Loading…
Cancel
Save