This commit is contained in:
2021-08-16 17:41:00 +08:00
parent dfd370a9b0
commit dba64994c3
44 changed files with 1962 additions and 839 deletions
+135 -2
View File
@@ -1,7 +1,8 @@
using System;
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
@@ -10,6 +11,138 @@ namespace BLL
/// </summary>
public static class PersonService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.View_SitePerson_Person> getPersonLists = from x in db.View_SitePerson_Person select x;
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(string projectId, string unitId, string personName, string identityCard, string treamGroupId, string workPostIds,
bool ckTrain, bool ckIspost, bool ckJT, bool ckIdCardInfoNotOK, Grid Grid1)
{
IQueryable<Model.View_SitePerson_Person> getPersonList = getPersonLists.Where(x => x.ProjectId == projectId);
if (!string.IsNullOrEmpty(unitId))
{
if (unitId == "0")
{
getPersonList = getPersonList.Where(x => x.UnitId == null);
}
else
{
getPersonList = getPersonList.Where(x => x.UnitId == unitId);
}
}
if (!string.IsNullOrEmpty(personName))
{
getPersonList = getPersonList.Where(x => x.PersonName.Contains(personName));
}
if (!string.IsNullOrEmpty(identityCard))
{
getPersonList = getPersonList.Where(x => x.IdentityCard.Contains(identityCard));
}
if (!string.IsNullOrEmpty(treamGroupId) && treamGroupId != Const._Null)
{
getPersonList = getPersonList.Where(x => x.TeamGroupId == treamGroupId);
}
if (!string.IsNullOrEmpty(workPostIds))
{
getPersonList = getPersonList.Where(x => workPostIds.Contains(x.WorkPostId));
}
if (ckTrain)
{
getPersonList = getPersonList.Where(x => x.TrainCount == 0);
}
if (ckIspost)
{
getPersonList = getPersonList.Where(x => x.IsUsed == false || x.InTime.Value > DateTime.Now
|| (x.OutTime.HasValue && x.OutTime < DateTime.Now));
}
if (ckJT)
{
getPersonList = getPersonList.Where(x => x.RealNameAddTime == null);
}
if (ckIdCardInfoNotOK)
{
getPersonList = getPersonList.Where(x => x.IdentityCard == null || x.HeadImage == null || (x.IdentityCard.Length != 15 && x.IdentityCard.Length != 18));
}
count = getPersonList.Count();
if (count == 0)
{
return null;
}
getPersonList = SortConditionHelper.SortingAndPaging(getPersonList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getPersonList
select new
{
x.PersonId,
x.CardNo,
x.PersonName,
x.WorkPostName,
x.UnitName,
x.IdentityCard,
x.TeamGroupName,
x.InTime,
x.OutTime,
PersonState = getPersonState(x.IsUsed, x.AuditorDate, x.InTime, x.OutTime),
};
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public static string getPersonState(bool isUsed,DateTime? auditorDate,DateTime? inTime, DateTime? outTime)
{
string name = string.Empty;
if (isUsed == false && !auditorDate.HasValue)
{
name = "在审";
}
else if (isUsed == true && inTime <= DateTime.Now && (!outTime.HasValue || outTime >= DateTime.Now))
{
name = "在岗";
}
else if (isUsed == true && outTime.HasValue && outTime <= DateTime.Now)
{
name = "离岗";
}
else if (isUsed == false && auditorDate.HasValue)
{
name = "打回";
}
return name;
////在审
//int count0 = getViews.Where(x => x.IsUsed == false && !x.AuditorDate.HasValue).Count();
////在岗
//int count1 = getViews.Where(x => x.IsUsed == true && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime >= DateTime.Now)).Count();
////离岗
//int count2 = getViews.Where(x => x.IsUsed == true && x.OutTime <= DateTime.Now).Count();
////打回
//int count3 = getViews.Where(x => x.IsUsed == false && x.AuditorDate.HasValue).Count();
}
#endregion
/// <summary>
/// 根据主键获取人员信息
/// </summary>