This commit is contained in:
2023-08-29 18:56:49 +08:00
parent 6b420b5bd8
commit 6c19bf6a3e
56 changed files with 2342 additions and 2166 deletions
+83 -53
View File
@@ -589,72 +589,102 @@ namespace BLL
}
List<string> unitIdList = Funs.GetStrListByStr(unitIds, ',');
var getPersons = from x in db.View_SitePerson_Person
var getPersons = (from x in db.View_SitePerson_Person
where x.ProjectId == projectId && unitIdList.Contains(x.UnitId) && x.IsUsed == 1 &&(string.IsNullOrEmpty(strParam)||x.PersonName.Contains(strParam)) && (string.IsNullOrEmpty(InTime) || x.InTime < inDateTime)
&& x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime >= DateTime.Now)
select new Model.PersonItem
{
PersonId = x.PersonId,
CardNo = x.CardNo,
PersonName = x.PersonName,
SexName = x.SexName,
IdentityCard = x.IdentityCard,
Address = x.Address,
ProjectId = x.ProjectId,
ProjectCode = x.ProjectCode,
ProjectName = x.ProjectName,
UnitId = x.UnitId,
UnitCode = x.UnitCode,
UnitName = x.UnitName,
TeamGroupId = x.TeamGroupId,
TeamGroupName = x.TeamGroupName,
WorkPostId = x.WorkPostId,
WorkPostName = x.WorkPostName,
InTime = string.Format("{0:yyyy-MM-dd}", x.InTime),
OutTime = string.Format("{0:yyyy-MM-dd}", x.OutTime),
OutResult = x.OutResult,
Telephone = x.Telephone,
PhotoUrl = x.PhotoUrl,
DepartName = x.DepartName,
};
{
PersonId = x.PersonId,
CardNo = x.CardNo,
PersonName = x.PersonName,
SexName = x.SexName,
IdentityCard = x.IdentityCard,
Address = x.Address,
ProjectId = x.ProjectId,
ProjectCode = x.ProjectCode,
ProjectName = x.ProjectName,
UnitId = x.UnitId,
UnitCode = x.UnitCode,
UnitName = x.UnitName,
TeamGroupId = x.TeamGroupId,
TeamGroupName = x.TeamGroupName,
WorkPostId = x.WorkPostId,
WorkPostName = x.WorkPostName,
InTime = string.Format("{0:yyyy-MM-dd}", x.InTime),
OutTime = string.Format("{0:yyyy-MM-dd}", x.OutTime),
OutResult = x.OutResult,
Telephone = x.Telephone,
PhotoUrl = x.PhotoUrl,
DepartName = x.DepartName,
}).ToList();
if (!string.IsNullOrEmpty(workPostIds))
{
List<string> workPostIdList = Funs.GetStrListByStr(workPostIds, ',');
getPersons = getPersons.Where(x => workPostIdList.Contains(x.WorkPostId));
getPersons = getPersons.Where(x => workPostIdList.Contains(x.WorkPostId)).ToList();
}
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));
getPersons = getPersons.Where(x => ids.Contains(x.DepartId)).ToList();
}
List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
var getTrainType = TrainTypeService.GetTrainTypeById(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 == projectId && 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 == projectId && 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();
}
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 == projectId && 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 == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId
select x).FirstOrDefault();
if (getTrainPersonIdList2 == null)
{
getTrainPersonList.Add(item);
}
}
}
return getTrainPersonList;
}
else if (getTrainType != null && getTrainType.IsRepeat.HasValue && getTrainType.IsRepeat == true)//重复的 过滤人员
{
foreach (var item in getPersons)
{
int score = 80;
var sysTestRule = db.Sys_TestRule.FirstOrDefault();
if (sysTestRule != null)
{
if (sysTestRule.PassingScore > 0)
{
score = sysTestRule.PassingScore;
}
}
var getTrainPersonIdList2 = (from x in db.Training_TestRecord
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId
where x.TestScores > score
select x).FirstOrDefault();
if (getTrainPersonIdList2 != null)
{
continue;
}
getTrainPersonList.Add(item);
}
return getTrainPersonList;
}
else
{
return getPersons.ToList();
}
}
}
@@ -107,8 +107,8 @@ namespace BLL
isUpdate.HandleIdea = newHazardRegister.HandleIdea;
isUpdate.SafeSupervisionIsOK = newHazardRegister.SafeSupervisionIsOK;
}
isUpdate.States = newHazardRegister.States;
isUpdate.RectificationPeriod = newHazardRegister.RectificationPeriod;
isUpdate.States = newHazardRegister.States;
isUpdate.Risk_Level = newHazardRegister.Risk_Level;
}
db.SubmitChanges();
+41 -2
View File
@@ -247,6 +247,45 @@ namespace BLL
return getDataLists;
}
}
#endregion
}
#endregion
#region TrainingPlanId获取培训任务教材明细列表
/// <summary>
/// 根据TrainingPlanId获取培训任务教材明细列表
/// </summary>
/// <param name="trainingPlanId"></param>
/// <returns>培训计划人员</returns>
public static Model.Training_TaskItem updateTaskItemLearnTime(string taskItemId,DateTime startTime,DateTime endTime)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var q = from x in db.Training_TaskItem
where x.TaskItemId == taskItemId
select x;
var item = q.FirstOrDefault();
if (!item.StartTime.HasValue)
{
item.StartTime = startTime;
}
if (!item.LearnTime.HasValue)
{
item.LearnTime = 0;
}
var span = endTime.Subtract(startTime);
item.LearnTime = item.LearnTime.Value + (int)span.TotalMinutes;
item.EndTime = endTime;
db.SubmitChanges();
return item;
}
}
#endregion
}
}