1、优化考勤记录导入,优化出入记录写实名制推送记录表。2、优化考试答题,交卷接口方法。3、优化写入培训记录。

This commit is contained in:
2022-06-16 17:34:24 +08:00
parent b913f49cd8
commit 85a8b510ac
29 changed files with 488 additions and 534 deletions
+8
View File
@@ -245,6 +245,14 @@ namespace BLL
TestType = item.TestType,
Duration = newTestPlan.Duration,
};
if (string.IsNullOrEmpty(newTrainDetail.TestType))
{
var getTrainTypeName = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == newTrainDetail.TestPlanId);
if (getTrainTypeName != null)
{
newTrainDetail.TestType = getTrainTypeName.PlanName;
}
}
db.Training_TestRecord.InsertOnSubmit(newTrainDetail);
db.SubmitChanges();
}
+6 -53
View File
@@ -21,7 +21,6 @@ namespace BLL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getDataLists = (from x in db.Training_TestRecord
join y in db.SitePerson_Person on x.TestManId equals y.PersonId
where x.TestPlanId == testPlanId
orderby x.TestStartTime descending
select new Model.TestRecordItem
@@ -30,7 +29,7 @@ namespace BLL
ProjectId = x.ProjectId,
TestPlanId = x.TestPlanId,
TestManId = x.TestManId,
TestManName = y.PersonName,
//TestManName = db.SitePerson_Person.First(p=>x.TestManId ==p.PersonId).PersonName,
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
TestScores = x.TestScores ?? 0,
@@ -100,21 +99,20 @@ namespace BLL
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getDataLists = from x in db.Training_TestRecord
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
var getDataLists = from x in db.Training_TestRecord
where x.TestRecordId == testRecordId
select new Model.TestRecordItem
{
TestRecordId = x.TestRecordId,
ProjectId = x.ProjectId,
TestPlanId = x.TestPlanId,
TestPlanName = y.PlanName,
TestPlanName = x.TestType,
TestManId = x.TestManId,
TestManName = db.SitePerson_Person.First(u => u.PersonId == x.TestManId).PersonName,
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
TestPlanEndTime = x.TestStartTime.HasValue ? string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime.Value.AddMinutes(x.Duration)) : "",
Duration = y.Duration,
Duration = x.Duration,
TestScores = x.TestScores ?? 0,
TestType = x.TestType,
TemporaryUser = x.TemporaryUser,
@@ -572,62 +570,17 @@ namespace BLL
var getRItem = db.Training_TestRecordItem.Where(x => x.TestRecordId == getTestRecord.TestRecordId);
if (getRItem.Count() > 0)
{
getTestRecord.TestScores = getRItem.Sum(x => x.SubjectScore);
getTestRecord.TestScores = getRItem.Sum(x => x.SubjectScore ?? 0);
}
db.SubmitChanges();
getCode = getTestRecord.TestScores ?? 0;
}
}
return getCode;
}
#endregion
/// <summary>
///
/// </summary>
/// <param name="testPlanId"></param>
public static void updateAll(string testPlanId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
//// 获取考试计划
var getTestPlan = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == testPlanId);
if (getTestPlan != null)
{
//// 获取参加考试 记录
var getAllTestRecords = db.Training_TestRecord.Where(x => x.TestPlanId == getTestPlan.TestPlanId);
if (getAllTestRecords.Count() > 0)
{
/// 参加考试人数
int testManCout = getAllTestRecords.Select(x => x.TestManId).Distinct().Count();
//// 获取培训计划人员
var getAllTrainingTasks = db.Training_Task.Where(x => x.PlanId == getTestPlan.PlanId);
//// 考试人数大于等于 培训人数
if (testManCout >= getAllTrainingTasks.Count())
{
////所有人员 都交卷时 考试计划结束 状态置为3
var getAllTestRecord = getAllTestRecords.FirstOrDefault(x => !x.TestEndTime.HasValue);
if (getAllTestRecord == null)
{
var getTrainingTasks = getAllTrainingTasks.Where(x => x.States != "2" || x.States == null);
foreach (var item in getTrainingTasks)
{
item.States = "2";
db.SubmitChanges();
}
getTestPlan.States = "3";
db.SubmitChanges();
////TODO 讲培训计划 考试记录 写入到培训记录
APITrainRecordService.InsertTrainRecord(getTestPlan);
}
}
}
}
}
}
#region TestRecord生成一条补考记录
/// <summary>
/// 根据TestRecord生成一条补考记录