20230630人员自定义卡号验证

This commit is contained in:
2023-06-30 16:24:19 +08:00
parent 5d70c6f745
commit f20df61fe5
12 changed files with 343 additions and 4049 deletions
@@ -3,10 +3,13 @@ using Microsoft.SqlServer.Dts.Runtime;
using Model;
using NPOI.HSSF.Record.Aggregates;
using NPOI.SS.Formula.PTG;
using NPOI.XWPF.UserModel;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls.Primitives;
using WIA;
namespace BLL
{
@@ -661,8 +664,26 @@ namespace BLL
var item = db.SitePerson_Person.FirstOrDefault(x => x.SitePersonId == sitePersonId);
if (item != null)
{
var isNull = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.PersonId == item.PersonId && x.CheckResult == true);
if (isNull != null) ////参加过培训的人员
bool isok = false;
int getPassScores = SysConstSetService.getPassScore();
var getTestT = db.Training_TestRecord.FirstOrDefault(x => x.ProjectId == item.ProjectId && x.TestScores >= getPassScores && x.TestManId==item.PersonId);
if (getTestT != null)
{
isok = true;
}
else
{
var isNull = (from x in db.EduTrain_TrainRecord
join y in db.EduTrain_TrainRecordDetail on x.TrainingId equals y.TrainingId
where x.ProjectId == item.ProjectId && y.PersonId == item.PersonId && y.CheckResult == true
select x);
if (isNull.Count() > 0)
{
isok = true;
}
}
if (isok) ////参加过培训的人员
{
string prefix = UnitService.GetUnitCodeByUnitId(item.UnitId) + "-";
var getCarPerson = db.SitePerson_Person.Where(x => x.ProjectId == item.ProjectId && x.CardNo.Contains(prefix) && x.CardNo.Length > 5);
@@ -954,6 +975,29 @@ namespace BLL
{
info += "身份证号码不正确!";
}
if (!string.IsNullOrEmpty(person.CardNo))
{
var getSite = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.ProjectId == person.ProjectId && x.CardNo == person.CardNo && x.SitePersonId != person.SitePersonId);
if (getSite != null)
{
info += "卡号已存在!";
}
string prefix = UnitService.GetUnitCodeByUnitId(person.UnitId) + "-";
if (person.CardNo.Contains(prefix))
{
var getInt = Funs.GetNewInt(person.CardNo.Substring(person.CardNo.Length - 5));
if (!getInt.HasValue)
{
info += "卡号应为单位代码+'-'+五位流水号!";
}
}
else
{
info += "卡号应为单位代码+'-'+五位流水号!";
}
}
return info;
}
+4 -2
View File
@@ -642,7 +642,9 @@ namespace BLL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
List<Model.Person_Persons> list = new List<Model.Person_Persons>();
var getPersons = from x in db.Person_Persons select x;
var getPersons = from x in db.Person_Persons
where x.IsPost == true
select x;
if (!string.IsNullOrEmpty(unitId))
{
getPersons = getPersons.Where(x => x.UnitId == unitId);
@@ -651,7 +653,7 @@ namespace BLL
{
getPersons = getPersons.Where(x => x.DepartId == DepartId);
}
list = getPersons.OrderBy(x=>x.UnitId).OrderBy(x=>x.PersonName).ToList();
list = getPersons.OrderBy(x => x.UnitId).OrderBy(x => x.PersonName).ToList();
return list;
}
}