20210817人员批量离场修改

This commit is contained in:
杨红卫 2021-08-17 20:04:45 +08:00
parent 9b4b36afdd
commit 33835b762e
3 changed files with 33 additions and 20 deletions

View File

@ -69,14 +69,14 @@ namespace BLL
{ {
getPersonList = getPersonList.Where(x => x.TrainCount == 0); getPersonList = getPersonList.Where(x => x.TrainCount == 0);
} }
if (postType =="0") if (postType == "0")
{ {
getPersonList = getPersonList.Where(x => x.IsUsed == false || x.InTime.Value > DateTime.Now getPersonList = getPersonList.Where(x => x.IsUsed == false || x.InTime.Value > DateTime.Now
|| (x.OutTime.HasValue && x.OutTime < DateTime.Now)); || (x.OutTime.HasValue && x.OutTime < DateTime.Now));
} }
else if (postType == "1") else if (postType == "1")
{ {
getPersonList = getPersonList.Where(x => x.IsUsed == true && x.InTime <=DateTime.Now && (!x.OutTime.HasValue || x.OutTime.Value >DateTime.Now)); getPersonList = getPersonList.Where(x => x.IsUsed == true && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime.Value > DateTime.Now));
} }
if (ckJT) if (ckJT)
@ -116,7 +116,7 @@ namespace BLL
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static string getPersonState(bool isUsed,DateTime? auditorDate,DateTime? inTime, DateTime? outTime) public static string getPersonState(bool isUsed, DateTime? auditorDate, DateTime? inTime, DateTime? outTime)
{ {
string name = string.Empty; string name = string.Empty;
if (isUsed == false && !auditorDate.HasValue) if (isUsed == false && !auditorDate.HasValue)
@ -127,7 +127,7 @@ namespace BLL
{ {
name = "在岗"; name = "在岗";
} }
else if (isUsed == true && outTime.HasValue && outTime <= DateTime.Now) else if (isUsed == true && outTime.HasValue && outTime <= DateTime.Now)
{ {
name = "离岗"; name = "离岗";
} }
@ -471,7 +471,7 @@ namespace BLL
if (!newPerson.OutTime.HasValue) if (!newPerson.OutTime.HasValue)
{ {
newPerson.OutTime = null; newPerson.OutTime = null;
newPerson.ExchangeTime = null; newPerson.ExchangeTime = null;
} }
newPerson.ExchangeTime2 = null; newPerson.ExchangeTime2 = null;
newPerson.RealNameUpdateTime = null; newPerson.RealNameUpdateTime = null;
@ -503,6 +503,27 @@ namespace BLL
} }
} }
/// <summary>
/// 人员离岗
/// </summary>
/// <param name="person"></param>
public static void PersonOut(string personId, DateTime date)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var person = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == personId);
if (person != null)
{
person.OutTime = date;
person.IsUsed = true;
person.ExchangeTime = null;
person.ExchangeTime2 = null;
person.RealNameUpdateTime = null;
db.SubmitChanges();
}
}
}
/// <summary> /// <summary>
/// 根据人员Id删除一个人员信息 /// 根据人员Id删除一个人员信息
/// </summary> /// </summary>
@ -555,7 +576,7 @@ namespace BLL
{ {
foreach (var item in getTrainRecord) foreach (var item in getTrainRecord)
{ {
EduTrain_TrainRecordDetailService.DeleteTrainDetailByTrainDetail (item.TrainDetailId); EduTrain_TrainRecordDetailService.DeleteTrainDetailByTrainDetail(item.TrainDetailId);
} }
} }
///删除考试记录 ///删除考试记录
@ -611,7 +632,7 @@ namespace BLL
public static Model.SitePerson_Person GetPersonByProjectCodeIdentityCard(string projectCode, string identityCard) public static Model.SitePerson_Person GetPersonByProjectCodeIdentityCard(string projectCode, string identityCard)
{ {
if (!string.IsNullOrEmpty(identityCard)) if (!string.IsNullOrEmpty(identityCard))
{ {
var getProject = ProjectService.GetProjectByProjectCode(projectCode); var getProject = ProjectService.GetProjectByProjectCode(projectCode);
if (getProject != null) if (getProject != null)
{ {
@ -620,7 +641,7 @@ namespace BLL
else else
{ {
return Funs.DB.SitePerson_Person.FirstOrDefault(e => e.IdentityCard == identityCard && e.ProjectId == null); return Funs.DB.SitePerson_Person.FirstOrDefault(e => e.IdentityCard == identityCard && e.ProjectId == null);
} }
} }
else else
{ {

View File

@ -68,7 +68,7 @@
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server"> <f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items> <Items>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" ValidateForms="SimpleForm1" <f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" ValidateForms="SimpleForm1"
OnClick="btnSave_Click"> OnClick="btnSave_Click" >
</f:Button> </f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose"> <f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose">
</f:Button> </f:Button>

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.HSSE.SitePerson namespace FineUIPro.Web.HSSE.SitePerson
{ {
@ -85,17 +86,8 @@ namespace FineUIPro.Web.HSSE.SitePerson
{ {
foreach (var item in this.drpPerson.Values) foreach (var item in this.drpPerson.Values)
{ {
var person = BLL.PersonService.GetPersonById(item); DateTime date = Funs.GetNewDateTimeOrNow(this.txtChangeTime.Text);
if (person != null) PersonService.PersonOut(item, date);
{
person.OutTime = Funs.GetNewDateTime(this.txtChangeTime.Text);
person.IsUsed = true;
person.OutTime = null;
person.ExchangeTime = null;
person.ExchangeTime2 = null;
person.RealNameUpdateTime = null;
Funs.DB.SubmitChanges();
}
} }
BLL.LogService.AddSys_Log(this.CurrUser, "人员批量出场", null, BLL.Const.PersonListMenuId, BLL.Const.BtnModify); BLL.LogService.AddSys_Log(this.CurrUser, "人员批量出场", null, BLL.Const.PersonListMenuId, BLL.Const.BtnModify);