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
+2
View File
@@ -625,6 +625,7 @@
<Compile Include="PZHGL\InformationProject\WorkHandoverService.cs" />
<Compile Include="PZHGL\ProjectData\ProjectMapService.cs" />
<Compile Include="PZHGL\ProjectData\ProjectPageDataService.cs" />
<Compile Include="SortConditionHelper.cs" />
<Compile Include="SQLHelper.cs" />
<Compile Include="Common\Const.cs" />
<Compile Include="ErrLogInfo.cs" />
@@ -708,6 +709,7 @@
<Compile Include="ZHGL\ProjectAccident\AccidentStatisticsService.cs" />
<Compile Include="ZHGL\ProjectAccident\ProjectAccidentReportService.cs" />
<Compile Include="ZHGL\RealName\BasicDataService.cs" />
<Compile Include="ZHGL\RealName\LeavePostService.cs" />
<Compile Include="ZHGL\RealName\CityService.cs" />
<Compile Include="ZHGL\RealName\CountryService.cs" />
<Compile Include="ZHGL\RealName\RealNameMonitorService.cs" />
+4
View File
@@ -2810,6 +2810,10 @@ namespace BLL
/// </summary>
public const string PersonInfoTemplateUrl = "File\\Excel\\DataIn\\现场人员考勤导入模版.xls";
/// <summary>
/// 实名制人员考勤导入模版
/// </summary>
public const string RealName_LeavePostTemplateUrl = "File\\Excel\\DataIn\\实名制人员导入模版.xls";
/// <summary>
/// 专项检查导入模板
/// </summary>
public const string CheckSpecialTemplateUrl = "File\\Excel\\DataIn\\专项检查导入模板.xls";
+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>
+38
View File
@@ -0,0 +1,38 @@
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace BLL
{
public static class SortConditionHelper
{
public static IQueryable<T> DataSorting<T>(IQueryable<T> source, string sortExpression, string sortDirection)
{
string sortingDir = string.Empty;
if (sortDirection.ToUpper().Trim() == "ASC")
sortingDir = " OrderBy ";
else if (sortDirection.ToUpper().Trim() == "DESC")
sortingDir = " OrderByDescending ";
ParameterExpression param = Expression.Parameter(typeof(T), sortExpression);
PropertyInfo pi = typeof(T).GetProperty(sortExpression);
Type[] types = new Type[2];
types[0] = typeof(T);
types[1] = pi.PropertyType;
Expression expr = Expression.Call(typeof(Queryable), sortingDir, types, source.Expression, Expression.Lambda(Expression.Property(param, sortExpression), param));
IQueryable<T> query = source.AsQueryable().Provider.CreateQuery<T>(expr);
return query;
}
public static IQueryable<T> DataPaging<T>(IQueryable<T> source, int pageNumber, int pageSize)
{
return source.Skip(pageNumber * pageSize).Take(pageSize);
}
public static IQueryable<T> SortingAndPaging<T>(IQueryable<T> source, string sortExpression, string sortDirection, int pageNumber, int pageSize)
{
IQueryable<T> query = DataSorting<T>(source, sortExpression, sortDirection);
return DataPaging(query, pageNumber, pageSize);
}
}
}
+124
View File
@@ -0,0 +1,124 @@
using FineUIPro;
using System;
using System.Collections;
using System.Linq;
namespace BLL
{
public static class LeavePostService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.RealName_LeavePost> getLeavePosts = from x in db.RealName_LeavePost select x;
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(string states, string projectCode, string personName, string identityCard, Grid Grid1)
{
IQueryable<Model.RealName_LeavePost> getLeavePostList = getLeavePosts;
if (states == "1")
{
getLeavePostList = getLeavePostList.Where(x => x.OutTime.HasValue);
}
if (!string.IsNullOrEmpty(personName))
{
getLeavePostList = getLeavePostList.Where(x => x.PersonName.Contains(personName));
}
if (!string.IsNullOrEmpty(identityCard))
{
getLeavePostList = getLeavePostList.Where(x => x.IdentityCard.Contains(identityCard));
}
count = getLeavePostList.Count();
if (count == 0)
{
return null;
}
getLeavePostList = SortConditionHelper.SortingAndPaging(getLeavePostList.OrderBy(x=>x.ProjectCode), Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getLeavePostList
select new
{
x.NewId,
x.Id,
x.PersonName,
x.IdentityCard,
x.ProjectId,
x.ProjectCode,
x.ProjectShortName,
x.InTime,
x.OutTime,
};
}
#endregion
/// <summary>
/// 添加实名制人员信息
/// </summary>
/// <param name="LeavePost"></param>
public static void AddLeavePost(Model.RealName_LeavePost LeavePost)
{
Model.SGGLDB db = Funs.DB;
Model.RealName_LeavePost newLeavePost = new Model.RealName_LeavePost
{
NewId = SQLHelper.GetNewID(),
Id = LeavePost.Id,
PersonName = LeavePost.PersonName,
IdentityCard = LeavePost.IdentityCard,
ProjectId = LeavePost.ProjectId,
ProjectCode = LeavePost.ProjectCode,
ProjectShortName = LeavePost.ProjectShortName,
InTime = LeavePost.InTime,
OutTime = LeavePost.OutTime
};
db.RealName_LeavePost.InsertOnSubmit(newLeavePost);
db.SubmitChanges();
}
/// <summary>
/// 修改实名制人员信息
/// </summary>
/// <param name="LeavePost"></param>
public static void UpdateLeavePost(Model.RealName_LeavePost LeavePost)
{
Model.SGGLDB db = Funs.DB;
var getLeavePost = db.RealName_LeavePost.FirstOrDefault(e => e.NewId == LeavePost.NewId);
if (getLeavePost != null)
{
getLeavePost.OutTime = LeavePost.OutTime;
db.SubmitChanges();
}
}
/// <summary>
///
/// </summary>
/// <param name="LeavePost"></param>
public static void DeleteLeavePost()
{
Model.SGGLDB db = Funs.DB;
var getLeavePost = from x in db.RealName_LeavePost select x;
if (getLeavePost.Count() > 0)
{
db.RealName_LeavePost.DeleteAllOnSubmit(getLeavePost);
db.SubmitChanges();
}
}
}
}
+3 -4
View File
@@ -919,13 +919,12 @@ namespace BLL
where ((x.IdentityCard != null && x.IdentityCard != "" && identityCard == null) || (identityCard != null && x.IdentityCard == identityCard))
&& y.JTProjectCode == proCode
&& v.TeamId.HasValue && x.HeadImage != null && x.HeadImage.Length > 0
&& ((type == Const.BtnModify && !x.RealNameUpdateTime.HasValue) || (type != Const.BtnModify && !x.RealNameAddTime.HasValue))
&& ((x.IdcardType == null || x.IdcardType == "SHENFEN_ZHENGJIAN")
&& (x.IdentityCard.Length == 15 || x.IdentityCard.Length == 18))
&& ((type == Const.BtnModify && !x.RealNameUpdateTime.HasValue) || (type != Const.BtnModify && !x.RealNameAddTime.HasValue))
&& (x.IdentityCard.Length == 15 || x.IdentityCard.Length == 18)
select new
{
name = x.PersonName,
idcardType = x.IdcardType ?? "SHENFEN_ZHENGJIAN",
idcardType = "SHENFEN_ZHENGJIAN",
idcardNumber = x.IdentityCard,
idcardStartDate = x.IdcardStartDate.HasValue ? string.Format("{0:yyyy-MM-dd}", x.IdcardStartDate) : null,
idcardEndDate = x.IdcardEndDate.HasValue ? string.Format("{0:yyyy-MM-dd}", x.IdcardEndDate) : null,