master
xiaochanghai 11 months ago
parent d94d1ecb85
commit 947c393983
  1. 2
      Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs
  2. 20
      Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs
  3. 10
      Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs
  4. 4
      Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs

@ -819,7 +819,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
record.ActualEndTime = DateTime.Now;
#region 打分
if (record.ScoreStatus == Consts.DIC_EXAM_RECORD_SCORE_STATUS.NO_SCORE && record.Status == Consts.DIC_EXAM_RECORD_STATUS.EXAM_END && exampaper.ScoreMethod == DIC_EXAM_PAPER_SCORE_METHOD.SYSTEM)
if (record.ScoreStatus == Consts.DIC_EXAM_RECORD_SCORE_STATUS.NO_SCORE && exampaper.ScoreMethod == DIC_EXAM_PAPER_SCORE_METHOD.SYSTEM)
{
await ExamHelper.SystemMarkAsync(Db, record, recordDetails, recordDetailAnswers);
record.ScoreStatus = Consts.DIC_EXAM_RECORD_SCORE_STATUS.HAS_SCORE;

@ -1151,6 +1151,16 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
}
}
//public bool IsTimePeriodOverlap(DateTime firstStart, DateTime firstEnd, DateTime secondStart, DateTime secondEnd)
//{
// if (!(secondEnd < firstStart || secondStart > firstEnd))
// {
// return true ;
// }
// return false;
//}
public async Task<ServiceResult> UpdateStatus(long[] ids, string status)
{
@ -1229,6 +1239,7 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
|| (entity.EndTime >= exam.BeginTime && entity.EndTime <= exam.EndTime)
|| (exam.EndTime >= entity.BeginTime && exam.EndTime <= entity.EndTime)
|| (exam.EndTime >= entity.BeginTime && exam.EndTime <= entity.EndTime))
//if (IsTimePeriodOverlap(entity.BeginTime.Value.Date, entity.EndTime.Value.Date, exam.BeginTime.Value.Date, exam.EndTime.Value.Date))
return ServiceResult.OprateFailed($"课程【{course.CourseName}】已存在有效的考试管理数据【{exam.ExamName}({exam.ExamNo})】时间重叠!");
}
}
@ -1266,12 +1277,11 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
var inserts = new List<Ghre_StudyRecord>();
var snap = await Db.Queryable<Ghre_CourseSnap>().FirstAsync(x => x.CourseId == entity.CourseId);
DateTime courseTime = Db.GetDate();
var courseTime = Db.GetDate();
var courseEndTime = courseTime.Date.AddMonths(snap?.ValidityPeriod ?? 1);
#region 自动给学习记录匹配考试ID
var studyRecords = await Db.Queryable<Ghre_StudyRecord>()
var studyRecords = await Db.Queryable<Ghre_StudyRecord>()
.WhereIF(!entity.CourseId.IsNull(), x => x.CourseId == entity.CourseId)
.WhereIF(!entity.CourseSceneId.IsNull(), x => x.CourseSceneId == entity.CourseSceneId)
.Where(x => x.ExamId == null).ToListAsync();
@ -1298,7 +1308,7 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
CourseSceneId = entity.CourseSceneId,
JoinTime = courseTime,
CourseBeginTime = courseTime.Date,
CourseEndTime = courseTime.Date.AddMonths(snap?.ValidityPeriod ?? 1),
CourseEndTime = courseEndTime,
CourseType = Consts.DIC_EXAM_STAFF_SOURCE.MANUAL_REQUIRED,
CourseStatus = Consts.DIC_STUDY_RECORD_COURSE_STATUS_IN,
StudyStatus = Consts.DicStudyRecordStudyStatus.NO_JOIN

@ -307,9 +307,13 @@ namespace Tiobon.Core.Services
{
if (x.CourseBeginDate != null && x.CourseEndDate != null)
x.CourseDateString = DateTimeHelper.ConvertToDayString(x.CourseBeginDate) + "~" + DateTimeHelper.ConvertToDayString(x.CourseEndDate);
if (x.ExamBeginDate != null && x.ExamEndDate != null)
x.ExamDateString = DateTimeHelper.ConvertToDayString(x.ExamBeginDate) + "~" + DateTimeHelper.ConvertToDayString(x.ExamEndDate);
else x.ExamDateString = $"学完{x.AfterHowLong}天";
if (!x.ExamId.IsNull())
{
if (x.ExamBeginDate != null && x.ExamEndDate != null)
x.ExamDateString = DateTimeHelper.ConvertToDayString(x.ExamBeginDate) + "~" + DateTimeHelper.ConvertToDayString(x.ExamEndDate);
else x.ExamDateString = $"学完{x.AfterHowLong}天";
}
//if (x.CourseBeginDate != null && x.CourseEndDate != null)
// if (x.StudyProgress >= 100 || !(x.CourseBeginDate.Value.Date <= DateTime.Now.Date && x.CourseEndDate.Value.Date >= DateTime.Now.Date))

@ -210,6 +210,7 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
var ruleStaffIds = ruleStaffs.Select(x => x.StaffId).ToList();
var staffs = await Db.Queryable<Ghra_Staff>()
.Where(x => x.OutDate == null || (x.OutDate != null && x.Indate != null && x.Indate.Value.Date <= DateTime.Now.Date && x.Indate.Value.Date >= DateTime.Now.Date))
.WhereIF(!rule.ZoneId.IsNull(), x => x.ZoneID == rule.ZoneId)
.WhereIF(!rule.DeptId.IsNull(), x => x.DeptID == rule.DeptId)
.WhereIF(!rule.TitleId.IsNull(), x => x.TitleID == rule.TitleId)
@ -319,10 +320,8 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
.ExecuteCommandAsync();
}
await Db.Ado.CommitTranAsync();
string sql = @"UPDATE A
SET A.StaffName = B.StaffName, a.StaffNo = B.StaffNo
FROM Ghre_StudyRuleResult A LEFT JOIN Ghra_Staff B ON A.StaffId = B.StaffID
@ -332,6 +331,7 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
catch (Exception)
{
await Db.Ado.RollbackTranAsync();
}
return true;
}

Loading…
Cancel
Save