培训类型

This commit is contained in:
2023-06-05 16:26:23 +08:00
parent 156069a20b
commit 5e48a4ad91
7 changed files with 121 additions and 73 deletions
+43 -28
View File
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SgManager.AI;
using System;
@@ -518,33 +519,43 @@ namespace BLL
item.DepartName = depart.DepartName;
}
}
}
//List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
//var getTrainType = db.Base_TrainType.FirstOrDefault(e => e.TrainTypeId == trainTypeId);
//if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))
//{
// foreach (var item in getPersons)
// {
// var getTrainPersonIdList1 = (from x in db.EduTrain_TrainRecordDetail
// join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId
// where y.ProjectId ==null && y.TrainTypeId == trainTypeId && x.CheckResult == true && x.PersonId == item.PersonId
// select x).FirstOrDefault();
// if (getTrainPersonIdList1 == null)
// {
// var getTrainPersonIdList2 = (from x in db.Training_Task
// join y in db.Training_Plan on x.PlanId equals y.PlanId
// where y.ProjectId == null && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId
// select x).FirstOrDefault();
// if (getTrainPersonIdList2 == null)
// {
// getTrainPersonList.Add(item);
// }
// }
// }
// return getTrainPersonList;
//}
//else
if (!string.IsNullOrEmpty(trainTypeId) && trainTypeId == Const.SpecialSafeTrainId)//专项安全培训
{
var ids = db.Base_WorkPost.Where(x => x.PostType == "2").Select(x => x.WorkPostId).ToList();
getPersons = getPersons.Where(x => ids.Contains(x.DepartId));
}
List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
var getTrainType = db.Base_TrainType.FirstOrDefault(e => e.TrainTypeId == trainTypeId);
if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))
{
foreach (var item in getPersons)
{
var getTrainPersonIdList1 = (from x in db.EduTrain_TrainRecordDetail
join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId
where y.ProjectId == null && y.TrainTypeId == trainTypeId && x.CheckResult == true && x.PersonId == item.PersonId
select x).FirstOrDefault();
if (getTrainPersonIdList1 == null)
{
var getTrainPersonIdList2 = (from x in db.Training_Task
join y in db.Training_Plan on x.PlanId equals y.PlanId
where y.ProjectId == null && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId
select x).FirstOrDefault();
if (getTrainPersonIdList2 == null)
{
getTrainPersonList.Add(item);
}
}
}
return getTrainPersonList;
}
else
{
return getPersons.ToList();
}
@@ -611,7 +622,11 @@ namespace BLL
List<string> workPostIdList = Funs.GetStrListByStr(workPostIds, ',');
getPersons = getPersons.Where(x => workPostIdList.Contains(x.WorkPostId));
}
if (!string.IsNullOrEmpty(trainTypeId) &&trainTypeId == Const.SpecialSafeTrainId)//专项安全培训
{
var ids = db.Base_WorkPost.Where(x => x.PostType == "2").Select(x => x.WorkPostId).ToList();
getPersons = getPersons.Where(x => ids.Contains(x.DepartId));
}
List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
var getTrainType = TrainTypeService.GetTrainTypeById(trainTypeId);
if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))