202306131、新增项目级消息待办页面功能。2、新增项目单位是否同步实名制设置功能。3、优化考试合格自动生成卡号功能。
This commit is contained in:
@@ -510,24 +510,34 @@ namespace BLL
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static void SendCarNo()
|
||||
public static int SendCarNo(string projectId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
int count = 0;
|
||||
var getPersons = from x in db.SitePerson_Person
|
||||
where x.States == Const.State_1 && x.CardNo == null
|
||||
where x.States == Const.State_1 && x.CardNo == null && x.ProjectId == projectId
|
||||
select x;
|
||||
foreach (var item in getPersons)
|
||||
{
|
||||
|
||||
var isNull = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.PersonId == item.PersonId);
|
||||
if (isNull != null) ////未参加过培训的人员
|
||||
var isNull = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.PersonId == item.PersonId && x.CheckResult ==true);
|
||||
if (isNull != null) ////参加过培训的人员
|
||||
{
|
||||
item.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", item.ProjectId, UnitService.GetUnitCodeByUnitId(item.UnitId));
|
||||
db.SubmitChanges();
|
||||
string prefix = UnitService.GetUnitCodeByUnitId(item.UnitId) + "-";
|
||||
var getMaxCarNo = db.SitePerson_Person.Where(x => x.ProjectId == item.ProjectId && x.CardNo.Contains(prefix)).Max(x => x.CardNo);
|
||||
if (!string.IsNullOrEmpty(getMaxCarNo) && getMaxCarNo.Length > 5)
|
||||
{
|
||||
var getInt = Funs.GetNewInt(getMaxCarNo.Substring(getMaxCarNo.Length - 5));
|
||||
if (getInt.HasValue)
|
||||
{
|
||||
item.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", item.ProjectId, prefix);
|
||||
db.SubmitChanges();
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user