This commit is contained in:
parent
5ae8d3bae4
commit
f828ad7ac5
|
|
@ -1508,5 +1508,31 @@ namespace BLL
|
|||
|
||||
return strValues;
|
||||
}
|
||||
public static string getStrTrainingTestRecordByPersonId(string personId)
|
||||
{
|
||||
string strValues = string.Empty;
|
||||
var getDataLists = from x in Funs.DB.Training_TestRecord
|
||||
join z in Funs.DB.Training_TestPlan on x.TestPlanId equals z.TestPlanId
|
||||
where x.TestManId == personId
|
||||
orderby z.PlanDate descending
|
||||
select new
|
||||
{
|
||||
z.PlanName,
|
||||
z.PlanDate,
|
||||
CheckResultName = x.TestScores >=60 ? "合格" : "不合格",
|
||||
z.TestPlanId,
|
||||
};
|
||||
if (getDataLists.Count() > 0)
|
||||
{
|
||||
foreach (var item in getDataLists)
|
||||
{
|
||||
string strV = string.Format("{0:yyyy-MM-dd HH:mm}", item.PlanDate) + " " + item.PlanName + " " + item.CheckResultName + ";";
|
||||
strValues += strV;
|
||||
}
|
||||
}
|
||||
|
||||
return strValues;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using FineUIPro;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -183,6 +184,88 @@ namespace BLL
|
|||
}
|
||||
}
|
||||
}
|
||||
public static void AddPersonInOut(List<Model.SitePerson_PersonInOut> personInOutList)
|
||||
{
|
||||
using (Model.SGGLDB db1 = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
List<string> personIds = new List<string>();
|
||||
List<SitePerson_PersonInOut> newPersonInOutList = new List<SitePerson_PersonInOut>();
|
||||
List<SitePerson_PersonInOut> needInsertPersonInOutList = new List<SitePerson_PersonInOut>();
|
||||
foreach (var personInOut in personInOutList)
|
||||
{
|
||||
Model.SitePerson_PersonInOut newPersonInOut = new Model.SitePerson_PersonInOut
|
||||
{
|
||||
PersonInOutId = SQLHelper.GetNewID(),
|
||||
IsIn = personInOut.IsIn ?? true,
|
||||
ChangeTime = personInOut.ChangeTime,
|
||||
InOutWay = personInOut.InOutWay ?? Const.InOutWay_Other,
|
||||
WorkAreaId = personInOut.WorkAreaId,
|
||||
WorkAreaName = personInOut.WorkAreaName,
|
||||
OldID = personInOut.OldID,
|
||||
Address = personInOut.Address,
|
||||
Remark = personInOut.Remark,
|
||||
};
|
||||
if (!string.IsNullOrEmpty(personInOut.PersonId))
|
||||
{
|
||||
personIds.Add(personInOut.PersonId);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(personInOut.IdentityCard))
|
||||
{
|
||||
personIds.Add(personInOut.IdentityCard);
|
||||
}
|
||||
newPersonInOutList.Add(personInOut);
|
||||
}
|
||||
|
||||
List<Model.SitePerson_Person> person_Peoples = new List<Model.SitePerson_Person>();
|
||||
person_Peoples.AddRange(db1.SitePerson_Person.Where(x => x.ProjectId == personInOutList[0].ProjectId && personIds.Contains(x.PersonId)).ToList());
|
||||
person_Peoples.AddRange(db1.SitePerson_Person.Where(x => x.ProjectId == personInOutList[0].ProjectId && personIds.Contains(x.IdentityCard)).ToList());
|
||||
foreach (var newPersonInOut in newPersonInOutList)
|
||||
{
|
||||
Model.SitePerson_Person getPerson = new Model.SitePerson_Person();
|
||||
getPerson = person_Peoples.FirstOrDefault(x => x.PersonId == newPersonInOut.PersonId || x.IdentityCard == newPersonInOut.IdentityCard);
|
||||
if (getPerson != null && !string.IsNullOrEmpty(getPerson.PersonId))
|
||||
{
|
||||
newPersonInOut.ProjectId = getPerson.ProjectId;
|
||||
newPersonInOut.PersonId = getPerson.PersonId;
|
||||
newPersonInOut.PersonName = getPerson.PersonName;
|
||||
newPersonInOut.IdentityCard = getPerson.IdentityCard;
|
||||
newPersonInOut.UnitId = getPerson.UnitId;
|
||||
newPersonInOut.UnitName = UnitService.GetUnitNameByUnitId(getPerson.UnitId);
|
||||
newPersonInOut.WorkPostId = getPerson.WorkPostId;
|
||||
if (!string.IsNullOrEmpty(getPerson.WorkPostId))
|
||||
{
|
||||
var getWorkPost = WorkPostService.GetWorkPostById(getPerson.WorkPostId);
|
||||
if (getWorkPost != null)
|
||||
{
|
||||
newPersonInOut.WorkPostName = getWorkPost.WorkPostName;
|
||||
newPersonInOut.PostType = getWorkPost.PostType;
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(newPersonInOut.WorkAreaName) && !string.IsNullOrEmpty(newPersonInOut.WorkAreaId))
|
||||
{
|
||||
newPersonInOut.WorkAreaName = UnitWorkService.GetUnitWorkName(newPersonInOut.WorkAreaId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!getPerson.OutTime.HasValue || getPerson.OutTime > DateTime.Now)
|
||||
{
|
||||
//// 插入当日记录表
|
||||
needInsertPersonInOutList.Add(newPersonInOut);
|
||||
}
|
||||
}
|
||||
db1.SitePerson_PersonInOut.InsertAllOnSubmit(newPersonInOutList);
|
||||
db1.SubmitChanges();
|
||||
|
||||
if (needInsertPersonInOutList.Count>0)
|
||||
{
|
||||
//// 插入当日记录表
|
||||
PersonInOutService.InsertPersonInOutNowNow(needInsertPersonInOutList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 插入当日出入记录表
|
||||
|
|
@ -273,6 +356,104 @@ namespace BLL
|
|||
}
|
||||
}
|
||||
}
|
||||
public static void InsertPersonInOutNowNow(List<Model.SitePerson_PersonInOut> PersonInOuts)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
List<string> unitIds = new List<string>();
|
||||
List<SitePerson_PersonInOutNow> newPersonInOutList = new List<SitePerson_PersonInOutNow>();
|
||||
foreach (var PersonInOut in PersonInOuts)
|
||||
{
|
||||
Model.SitePerson_PersonInOutNow newPersonInOut = new Model.SitePerson_PersonInOutNow
|
||||
{
|
||||
PersonInOutId = PersonInOut.PersonInOutId,
|
||||
ProjectId = PersonInOut.ProjectId,
|
||||
UnitId = PersonInOut.UnitId,
|
||||
UnitName = PersonInOut.UnitName,
|
||||
PersonId = PersonInOut.PersonId,
|
||||
PersonName = PersonInOut.PersonName,
|
||||
IsIn = PersonInOut.IsIn,
|
||||
ChangeTime = PersonInOut.ChangeTime,
|
||||
WorkPostId = PersonInOut.WorkPostId,
|
||||
WorkPostName = PersonInOut.WorkPostName,
|
||||
PostType = PersonInOut.PostType,
|
||||
Name = PersonInOut.PersonName,
|
||||
IdentityCard = PersonInOut.IdentityCard,
|
||||
IdcardNumber = PersonInOut.IdentityCard,
|
||||
CheckType = "ZHENGCHANG_KAOQINLEIBIE",
|
||||
CheckWay = "FACE_FANGSHI",
|
||||
InOutWay = PersonInOut.InOutWay,
|
||||
Address = PersonInOut.Address,
|
||||
Remark = PersonInOut.Remark,
|
||||
};
|
||||
unitIds.Add(PersonInOut.UnitId);
|
||||
newPersonInOutList.Add(newPersonInOut);
|
||||
}
|
||||
db.SitePerson_PersonInOutNow.InsertAllOnSubmit(newPersonInOutList);
|
||||
db.SubmitChanges();
|
||||
|
||||
string proCode = ProjectService.GetContractNoByProjectId(PersonInOuts[0].ProjectId);
|
||||
var getRealNameP = db.RealName_Project.FirstOrDefault(x => x.ProCode == proCode);
|
||||
|
||||
/// 监理 业主 不进入
|
||||
var getPUnitS = db.Project_ProjectUnit.Where(x => x.ProjectId == PersonInOuts[0].ProjectId && unitIds.Contains(x.UnitId)).ToList();
|
||||
|
||||
foreach (var newPersonInOut in newPersonInOutList)
|
||||
{
|
||||
var getPUnit = getPUnitS.FirstOrDefault(x => x.UnitId == newPersonInOut.UnitId);
|
||||
if (getPUnit.UnitType != Const.ProjectUnitType_3 && getPUnit.UnitType != Const.ProjectUnitType_4 && getPUnit.IsSynchro == true)
|
||||
{
|
||||
if (getRealNameP != null && newPersonInOut.ChangeTime.HasValue)
|
||||
{
|
||||
var getNow = db.RealName_PersonInOutNow.FirstOrDefault(x => x.PersonInOutId == newPersonInOut.PersonInOutId);
|
||||
if (getNow == null)
|
||||
{
|
||||
int hour = newPersonInOut.ChangeTime.Value.Hour;
|
||||
bool isIn = newPersonInOut.IsIn ?? true;
|
||||
DateTime date = newPersonInOut.ChangeTime.Value;
|
||||
var getMorning = db.RealName_PersonInOutNow.FirstOrDefault(x => x.PersonId == newPersonInOut.PersonId
|
||||
&& ((x.ChangeTime.Value.Hour < 12 && hour < 12) || (x.ChangeTime.Value.Hour >= 12 && hour >= 12))
|
||||
&& x.ChangeTime >= date.Date && x.ChangeTime.Value < date.Date.AddDays(1)
|
||||
&& ((x.IsIn == true && x.ChangeTime < date) || (x.IsIn == false && x.ChangeTime > date)));
|
||||
if (getMorning == null)
|
||||
{
|
||||
Model.RealName_PersonInOutNow newR = new Model.RealName_PersonInOutNow
|
||||
{
|
||||
PersonInOutId = newPersonInOut.PersonInOutId,
|
||||
ProjectId = newPersonInOut.ProjectId,
|
||||
UnitId = newPersonInOut.UnitId,
|
||||
PersonId = newPersonInOut.PersonId,
|
||||
IsIn = newPersonInOut.IsIn,
|
||||
ChangeTime = newPersonInOut.ChangeTime,
|
||||
WorkPostId = newPersonInOut.WorkPostId,
|
||||
PostType = newPersonInOut.PostType,
|
||||
ProCode = proCode,
|
||||
Name = newPersonInOut.PersonName,
|
||||
IdcardType = "SHENFEN_ZHENGJIAN",
|
||||
IdcardNumber = newPersonInOut.IdentityCard,
|
||||
CheckType = "ZHENGCHANG_KAOQINLEIBIE",
|
||||
CheckWay = "FACE_FANGSHI",
|
||||
};
|
||||
db.RealName_PersonInOutNow.InsertOnSubmit(newR);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
db.SubmitChanges();
|
||||
var getLastList = from x in db.SitePerson_PersonInOutNow
|
||||
where x.ChangeTime <= PersonInOuts[0].ChangeTime.Value.AddHours(-48)
|
||||
select x;
|
||||
if (getLastList.Count() > 0)
|
||||
{
|
||||
db.SitePerson_PersonInOutNow.DeleteAllOnSubmit(getLastList);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 更新人员出入记录
|
||||
|
|
|
|||
|
|
@ -17017,7 +17017,7 @@
|
|||
</COMReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Model.APIItem
|
||||
{
|
||||
public class PersonInOutItem
|
||||
{
|
||||
public string projectId { get; set; }
|
||||
public string idCard { get; set; }
|
||||
public int isIn { get; set; }
|
||||
public DateTime changeTime { get; set; }
|
||||
public string deviceIp { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -156,6 +156,7 @@
|
|||
<Compile Include="APIItem\Law_RulesRegulations.cs" />
|
||||
<Compile Include="APIItem\NoticeOutput.cs" />
|
||||
<Compile Include="APIItem\OperationReportDto.cs" />
|
||||
<Compile Include="APIItem\PersonInOutItem.cs" />
|
||||
<Compile Include="APIItem\ProjectItem.cs" />
|
||||
<Compile Include="APIItem\HSSE\PunishNoticeItem.cs" />
|
||||
<Compile Include="APIItem\HSSE\PunishNoticeItemItem.cs" />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -693,6 +694,9 @@ namespace WebAPI.Controllers
|
|||
/// <param name="isIn"></param>
|
||||
/// <param name="changeTime"></param>
|
||||
/// <returns></returns>
|
||||
///
|
||||
[HttpGet]
|
||||
|
||||
public Model.ResponeData getPersonInOut(string projectId, string idCard, int isIn, DateTime changeTime)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
|
|
@ -705,7 +709,7 @@ namespace WebAPI.Controllers
|
|||
IdentityCard = idCard,
|
||||
IsIn = isIn == 1 ? true : false,
|
||||
ChangeTime = changeTime,
|
||||
InOutWay = Const.InOutWay_1,
|
||||
InOutWay = Const.InOutWay_1
|
||||
};
|
||||
|
||||
PersonInOutService.AddPersonInOut(newInOut);
|
||||
|
|
@ -719,6 +723,41 @@ namespace WebAPI.Controllers
|
|||
}
|
||||
return responeData;
|
||||
}
|
||||
[HttpPost]
|
||||
public Model.ResponeData getPersonInOut([FromBody] List<Model.APIItem.PersonInOutItem> personInOutItem)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
if (personInOutItem.Count > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<SitePerson_PersonInOut> newInOutList = new List<SitePerson_PersonInOut>();
|
||||
foreach (var item in personInOutItem)
|
||||
{
|
||||
Model.SitePerson_PersonInOut newInOut = new Model.SitePerson_PersonInOut
|
||||
{
|
||||
ProjectId = item.projectId,
|
||||
IdentityCard = item.idCard,
|
||||
IsIn = item.isIn == 1 ? true : false,
|
||||
ChangeTime = item.changeTime,
|
||||
InOutWay = Const.InOutWay_1,
|
||||
Address = item.deviceIp
|
||||
};
|
||||
newInOutList.Add(newInOut);
|
||||
}
|
||||
PersonInOutService.AddPersonInOut(newInOutList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 保存人员出入记录
|
||||
|
|
@ -819,11 +858,10 @@ namespace WebAPI.Controllers
|
|||
responeData.data = (from x in Funs.DB.SitePerson_Person
|
||||
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
|
||||
join persons in Funs.DB.Person_Persons on x.IdentityCard equals persons.IdentityCard
|
||||
join traindetail in Funs.DB.EduTrain_TrainRecordDetail on x.PersonId equals traindetail.PersonId
|
||||
join train in Funs.DB.EduTrain_TrainRecord on traindetail.TrainingId equals train.TrainingId
|
||||
where x.ProjectId == projectId && !x.ExchangeTime.HasValue && train.ProjectId == projectId
|
||||
&& x.States == Const.ProjectPersonStates_1 && x.CardNo.Length > 5 && persons.PhotoUrl != null
|
||||
// where personIds.Contains(x.PersonId)
|
||||
join traindetail in Funs.DB.Training_TestRecord on x.PersonId equals traindetail.TestManId
|
||||
where x.ProjectId == projectId && !x.ExchangeTime.HasValue && traindetail.ProjectId == projectId
|
||||
&& x.States == Const.ProjectPersonStates_1 && x.CardNo.Length > 5 && persons.PhotoUrl != null && traindetail.TestScores >= 60
|
||||
// where personIds.Contains(x.PersonId)
|
||||
select new
|
||||
{
|
||||
x.PersonId,
|
||||
|
|
@ -841,7 +879,7 @@ namespace WebAPI.Controllers
|
|||
Funs.DB.ProjectData_TeamGroup.First(z => z.TeamGroupId == x.TeamGroupId).TeamGroupName,
|
||||
persons.Telephone,
|
||||
persons.Address,
|
||||
TrainRecord = APIPersonService.getStrTrainRecordByPersonId(x.PersonId),
|
||||
TrainRecord = APIPersonService.getStrTrainingTestRecordByPersonId(x.PersonId),
|
||||
x.ExchangeTime,
|
||||
x.ExchangeTime2,
|
||||
x.AuditorDate,
|
||||
|
|
@ -985,6 +1023,10 @@ namespace WebAPI.Controllers
|
|||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region 获取人员信息出入场记录-查询
|
||||
/// <summary>
|
||||
/// 获取人员信息出入场记录
|
||||
|
|
|
|||
Loading…
Reference in New Issue