Explorar el Código

【修改】学生按天请假对接课表请假和考勤;学生按课表请假对接考勤;加去重;

新疆警官学校中职
dyy hace 2 años
padre
commit
6c0c3a47a2
Se han modificado 5 ficheros con 202 adiciones y 147 borrados
  1. +23
    -23
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuAttendanceLeaveController.cs
  2. +25
    -25
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuAttendanceLeaveApi.cs
  3. +19
    -7
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceService.cs
  4. +17
    -2
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendanceLeave/StuAttendanceLeaveService.cs
  5. +118
    -90
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementService.cs

+ 23
- 23
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuAttendanceLeaveController.cs Ver fichero

@@ -135,46 +135,46 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
public ActionResult SaveForm(string keyValue, string strEntity)
{
StuAttendanceLeaveEntity entity = strEntity.ToObject<StuAttendanceLeaveEntity>();
entity.TeachClassNo = entity.ClassNo;
stuAttendanceLeaveIBLL.SaveEntity(keyValue, entity);

if (!string.IsNullOrEmpty(entity.IsCheck))
{
if (entity.IsCheck == "1")
{
//todo:暂时隐藏!需要进行去重判断!
var gender = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(entity.StuNo)?.GenderNo;
StuAttendanceEntity stuAttendanceEntity = new StuAttendanceEntity();
stuAttendanceEntity.AcademicYearNo = entity.AcademicYearNo;
stuAttendanceEntity.ClassName = entity.ClassName;
stuAttendanceEntity.ClassNo = entity.ClassNo;
stuAttendanceEntity.DeptName = entity.DeptName;
stuAttendanceEntity.DeptNo = entity.DeptNo;
stuAttendanceEntity.EmpNo = entity.EmpNo;
stuAttendanceEntity.Semester = entity.Semester;
stuAttendanceEntity.StuNo = entity.StuNo;
stuAttendanceEntity.StuName = entity.StuName;
stuAttendanceEntity.Gender = Convert.ToBoolean(gender) ? "男" : "女";
stuAttendanceEntity.Grade = entity.Grade;
stuAttendanceEntity.InertDate = DateTime.Now;
stuAttendanceEntity.LessonDate = entity.LessonDate;
stuAttendanceEntity.LessonName = entity.LessonName;
stuAttendanceEntity.DeptNo = entity.DeptNo;
stuAttendanceEntity.DeptName = entity.DeptName;
stuAttendanceEntity.MajorNo = entity.MajorNo;
stuAttendanceEntity.MajorName = entity.MajorName;
stuAttendanceEntity.ClassNo = entity.ClassNo;
stuAttendanceEntity.ClassName = entity.ClassName;
stuAttendanceEntity.LessonNo = entity.LessonNo;
stuAttendanceEntity.LessonSortName = entity.LessonSortName;
stuAttendanceEntity.LessonName = entity.LessonName;
stuAttendanceEntity.TeachClassNo = entity.TeachClassNo;
stuAttendanceEntity.LessonSortNo = entity.LessonSortNo;
stuAttendanceEntity.LessonTime = entity.LessonTime;
stuAttendanceEntity.MajorName = entity.MajorName;
stuAttendanceEntity.MajorNo = entity.MajorNo;
stuAttendanceEntity.LessonSortName = entity.LessonSortName;
stuAttendanceEntity.LessonDate = entity.LessonDate;
stuAttendanceEntity.PlanWeek = null;
stuAttendanceEntity.Semester = entity.Semester;
stuAttendanceEntity.StuName = entity.StuName;
stuAttendanceEntity.StuNo = entity.StuNo;
stuAttendanceEntity.TeachClassNo = entity.TeachClassNo;
stuAttendanceEntity.Sort = "请假";
stuAttendanceEntity.LessonTime = entity.LessonTime;
stuAttendanceEntity.AttendOrNo = "否";
stuAttendanceEntity.ClassRoomName = entity.ClassRoomName;
stuAttendanceEntity.ClassRoomNo = entity.ClassRoomNo;
stuAttendanceEntity.Gender = Convert.ToBoolean(gender) ? "男" : "女";
stuAttendanceEntity.AcademicYearNo = entity.AcademicYearNo;
stuAttendanceEntity.Sort = Convert.ToInt32(entity.LeaveType)==2?"病假":"事假";
stuAttendanceEntity.EmpNo = entity.EmpNo;
stuAttendanceEntity.Remark = "属于PC端的学生课表请假审核";
stuAttendanceEntity.CheckMarkDept = "";
stuAttendanceEntity.CheckMark = "";
stuAttendanceEntity.InertDate = DateTime.Now;
stuAttendanceEntity.ClassRoomNo = entity.ClassRoomNo;
stuAttendanceEntity.ClassRoomName = entity.ClassRoomName;

//stuAttendanceIBLL.SaveEntity("", stuAttendanceEntity);
stuAttendanceIBLL.SaveEntity("", stuAttendanceEntity);

}
}


+ 25
- 25
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuAttendanceLeaveApi.cs Ver fichero

@@ -133,45 +133,45 @@ namespace Learun.Application.WebApi
{
ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
StuAttendanceLeaveEntity entity = parameter.strEntity.ToObject<StuAttendanceLeaveEntity>();
stuAttendanceLeaveIBLL.SaveEntity(this.userInfo, parameter.keyValue, entity);
entity.TeachClassNo = entity.ClassNo;
stuAttendanceLeaveIBLL.SaveEntity(parameter.keyValue, entity);
if (!string.IsNullOrEmpty(entity.IsCheck))
{
if (entity.IsCheck == "1")
{
//todo:暂时隐藏!需要进行去重判断!
var gender = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(entity.StuNo)?.GenderNo;
StuAttendanceEntity stuAttendanceEntity = new StuAttendanceEntity();
stuAttendanceEntity.AcademicYearNo = entity.AcademicYearNo;
stuAttendanceEntity.ClassName = entity.ClassName;
stuAttendanceEntity.ClassNo = entity.ClassNo;
stuAttendanceEntity.DeptName = entity.DeptName;
stuAttendanceEntity.DeptNo = entity.DeptNo;
stuAttendanceEntity.EmpNo = entity.EmpNo;
stuAttendanceEntity.Semester = entity.Semester;
stuAttendanceEntity.StuNo = entity.StuNo;
stuAttendanceEntity.StuName = entity.StuName;
stuAttendanceEntity.Gender = Convert.ToBoolean(gender) ? "男" : "女";
stuAttendanceEntity.Grade = entity.Grade;
stuAttendanceEntity.InertDate = DateTime.Now;
stuAttendanceEntity.LessonDate = entity.LessonDate;
stuAttendanceEntity.LessonName = entity.LessonName;
stuAttendanceEntity.DeptNo = entity.DeptNo;
stuAttendanceEntity.DeptName = entity.DeptName;
stuAttendanceEntity.MajorNo = entity.MajorNo;
stuAttendanceEntity.MajorName = entity.MajorName;
stuAttendanceEntity.ClassNo = entity.ClassNo;
stuAttendanceEntity.ClassName = entity.ClassName;
stuAttendanceEntity.LessonNo = entity.LessonNo;
stuAttendanceEntity.LessonSortName = entity.LessonSortName;
stuAttendanceEntity.LessonName = entity.LessonName;
stuAttendanceEntity.TeachClassNo = entity.TeachClassNo;
stuAttendanceEntity.LessonSortNo = entity.LessonSortNo;
stuAttendanceEntity.LessonTime = entity.LessonTime;
stuAttendanceEntity.MajorName = entity.MajorName;
stuAttendanceEntity.MajorNo = entity.MajorNo;
stuAttendanceEntity.LessonSortName = entity.LessonSortName;
stuAttendanceEntity.LessonDate = entity.LessonDate;
stuAttendanceEntity.PlanWeek = null;
stuAttendanceEntity.Semester = entity.Semester;
stuAttendanceEntity.StuName = entity.StuName;
stuAttendanceEntity.StuNo = entity.StuNo;
stuAttendanceEntity.TeachClassNo = entity.TeachClassNo;
stuAttendanceEntity.Sort = "请假";
stuAttendanceEntity.LessonTime = entity.LessonTime;
stuAttendanceEntity.AttendOrNo = "否";
stuAttendanceEntity.ClassRoomName = entity.ClassRoomName;
stuAttendanceEntity.ClassRoomNo = entity.ClassRoomNo;
stuAttendanceEntity.Gender = Convert.ToBoolean(gender) ? "男" : "女";
stuAttendanceEntity.AcademicYearNo = entity.AcademicYearNo;
stuAttendanceEntity.CheckMarkDept = "";
stuAttendanceEntity.Sort = Convert.ToInt32(entity.LeaveType) == 2 ? "病假" : "事假";
stuAttendanceEntity.EmpNo = entity.EmpNo;
stuAttendanceEntity.Remark = "属于移动端的学生课表请假审核";
stuAttendanceEntity.CheckMark = "";
stuAttendanceEntity.CheckMarkDept = "";
stuAttendanceEntity.InertDate = DateTime.Now;
stuAttendanceEntity.ClassRoomNo = entity.ClassRoomNo;
stuAttendanceEntity.ClassRoomName = entity.ClassRoomName;

//stuAttendanceIBLL.SaveEntity("", stuAttendanceEntity);
stuAttendanceIBLL.SaveEntity("", stuAttendanceEntity);

}
}


+ 19
- 7
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceService.cs Ver fichero

@@ -484,8 +484,22 @@ where 1=1 ");
}
else
{
entity.Create();
this.BaseRepository("CollegeMIS").Insert(entity);
//去重:多条件再次查找是否有新增的考勤记录;
var isExistModel = this.BaseRepository("CollegeMIS").FindEntity<StuAttendanceEntity>(x =>
x.AcademicYearNo == entity.AcademicYearNo && x.Semester == entity.Semester && x.StuNo == entity.StuNo &&
x.LessonNo == entity.LessonNo && x.TeachClassNo == entity.TeachClassNo && x.LessonSortNo == entity.LessonSortNo &&
x.LessonDate == entity.LessonDate && x.LessonTime == entity.LessonTime && x.EmpNo == entity.EmpNo && x.ClassRoomNo == entity.ClassRoomNo);
if (isExistModel != null)
{
entity.Modify(isExistModel.ID);
this.BaseRepository("CollegeMIS").Update(entity);
}
else
{
entity.Create();
this.BaseRepository("CollegeMIS").Insert(entity);
}

}
}
catch (Exception ex)
@@ -642,10 +656,8 @@ where 1=1 ");
model.InertDate = DateTime.Now;
model.ClassRoomNo = classRoomNo;
model.ClassRoomName = classRoomList.Find(x => x.ClassroomId.Trim() == classRoomNo.Trim())?.ClassroomName.Trim();
//var ifExistModel = BaseRepository("CollegeMIS").FindEntity<StuAttendanceEntity>(m =>
// m.EmpNo == model.EmpNo && m.AcademicYearNo == model.AcademicYearNo &&
// m.Semester == model.Semester && m.StuNo == model.StuNo &&
// m.TeachClassNo == model.TeachClassNo);
//判断考勤ID是否存在
if (!string.IsNullOrEmpty(stuSelectLessonListEntity.StuAttendanceNo))
{
model.Modify(stuSelectLessonListEntity.StuAttendanceNo);
@@ -653,7 +665,7 @@ where 1=1 ");
}
else
{
//多条件再次查找是否有新增的考勤记录;
//去重:多条件再次查找是否有新增的考勤记录;
var isExistModel = this.BaseRepository("CollegeMIS").FindEntity<StuAttendanceEntity>(x =>
x.AcademicYearNo == model.AcademicYearNo && x.Semester == model.Semester && x.StuNo == model.StuNo &&
x.LessonNo == model.LessonNo && x.TeachClassNo == model.TeachClassNo && x.LessonSortNo == model.LessonSortNo &&


+ 17
- 2
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendanceLeave/StuAttendanceLeaveService.cs Ver fichero

@@ -325,8 +325,23 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
else
{
entity.Create();
this.BaseRepository("CollegeMIS").Insert(entity);
//去重:多条件查询是否有新增数据
var isExistModel = this.BaseRepository("CollegeMIS").FindEntity<StuAttendanceLeaveEntity>(x =>
x.AcademicYearNo == entity.AcademicYearNo && x.Semester == entity.Semester &&
x.StuNo == entity.StuNo && x.LessonNo == entity.LessonNo && x.TeachClassNo == entity.TeachClassNo &&
x.LessonSortNo == entity.LessonSortNo && x.LessonDate == entity.LessonDate && x.LessonTime == entity.LessonTime &&
x.EmpNo == entity.EmpNo && x.ClassRoomNo == entity.ClassRoomNo
);
if (isExistModel != null)
{
entity.Modify(isExistModel.ID);
this.BaseRepository("CollegeMIS").Update(entity);
}
else
{
entity.Create();
this.BaseRepository("CollegeMIS").Insert(entity);
}
}
}
catch (Exception ex)


+ 118
- 90
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementService.cs Ver fichero

@@ -270,99 +270,127 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
{
entity.Modify(keyValue);
db.Update(entity);
if (entity.CheckStatus.Trim() == "1" && entity.StartTime != null)
{
//请假审核通过后,该学生的对应日期的课表改为请假
var model = this.BaseRepository("CollegeMIS").FindList<StuLeaveManagementEntity>(
$"select * from StuLeaveManagement where Id='{keyValue}'").FirstOrDefault();
//请假开始时间和结束时间
var startTime = Convert.ToDateTime(model.StartTime?.ToString("yyyy-MM-dd") + " 00:00:00");
var endTime = Convert.ToDateTime(model.EndTime?.ToString("yyyy-MM-dd") + " 23:59:59");

//TODO:暂时隐藏!待测试!考勤表出现重复数据问题!
// if (entity.CheckStatus.Trim() == "1" && entity.StartTime != null)
// {
// //请假审核通过后,该学生的对应日期的课表改为请假
// var model = db.FindList<StuLeaveManagementEntity>(
// $"select * from StuLeaveManagement where Id='{keyValue}'").FirstOrDefault();
// //请假开始时间和结束时间
// var startTime = Convert.ToDateTime(model.StartTime?.ToString("yyyy-MM-dd") + " 00:00:00");
// var endTime = Convert.ToDateTime(model.EndTime?.ToString("yyyy-MM-dd") + " 23:59:59");

// //排课数据
// var arrangeLessonTermList = db.FindList<ArrangeLessonTermEntity>($@"select a.*,b.StuName,b.Grade,b.GenderNo from [dbo].[ArrangeLessonTerm] a
//join stuinfobasic b on a.teachclassno=b.classno
//where b.stuno='{model.CreateUserNo}'
//and a.lessondate between '{startTime}' and '{endTime}'");

// var deptList = db.FindList<CdDeptEntity>();
// var majorList = db.FindList<CdMajorEntity>();
// var classInfoList = db.FindList<ClassInfoEntity>();
// var classRoomList = db.FindList<ClassroomInfoEntity>().ToList();
// var lessonSortList = db.FindList<CdLessonSortEntity>().ToList();
// foreach (var arrangeLessonTerm in arrangeLessonTermList)
// {
// StuAttendanceLeaveEntity stuAttendanceLeave = new StuAttendanceLeaveEntity();
// stuAttendanceLeave.Create();
// stuAttendanceLeave.AcademicYearNo = arrangeLessonTerm.AcademicYearNo;
// stuAttendanceLeave.Semester = arrangeLessonTerm.Semester;
// stuAttendanceLeave.StuNo = model.CreateUserNo;
// stuAttendanceLeave.StuName = arrangeLessonTerm.StuName;
// stuAttendanceLeave.Grade = arrangeLessonTerm.Grade;
// stuAttendanceLeave.DeptNo = arrangeLessonTerm.DeptNo;
// stuAttendanceLeave.DeptName = deptList.Where(x => x.DeptNo == arrangeLessonTerm.DeptNo)
// .FirstOrDefault()?.DeptName;
// stuAttendanceLeave.MajorNo = arrangeLessonTerm.MajorNo;
// stuAttendanceLeave.MajorName = majorList.Where(x => x.MajorNo == arrangeLessonTerm.MajorNo)
// .FirstOrDefault()?.MajorName;
// stuAttendanceLeave.ClassNo = arrangeLessonTerm.TeachClassNo;
// stuAttendanceLeave.ClassName = classInfoList
// .Where(x => x.ClassNo == arrangeLessonTerm.TeachClassNo).FirstOrDefault()?.ClassName;
// stuAttendanceLeave.LessonNo = arrangeLessonTerm.LessonNo;
// stuAttendanceLeave.LessonName = arrangeLessonTerm.LessonName;
// stuAttendanceLeave.TeachClassNo = arrangeLessonTerm.TeachClassNo;
// stuAttendanceLeave.LessonSortNo = arrangeLessonTerm.LessonSortNo;
// stuAttendanceLeave.LessonSortName = lessonSortList.Find(m => m.LessonSortNo == arrangeLessonTerm.LessonSortNo)?.LessonSortName;
// stuAttendanceLeave.LessonDate = arrangeLessonTerm.LessonDate;
// stuAttendanceLeave.LessonTime = arrangeLessonTerm.LessonTime;
// stuAttendanceLeave.LeaveType = "1";
// stuAttendanceLeave.EmpNo = arrangeLessonTerm.EmpNo;
// stuAttendanceLeave.ClassRoomNo = arrangeLessonTerm.ClassroomNo;
// stuAttendanceLeave.UpdateDate = DateTime.Now;
// stuAttendanceLeave.IsCheck = "1";
// stuAttendanceLeave.TecRemark = "按天请假";

// db.Insert(stuAttendanceLeave);
//排课数据
var arrangeLessonTermList = db.FindList<ArrangeLessonTermEntity>($@"select a.*,b.StuName,b.Grade,b.GenderNo from [dbo].[ArrangeLessonTerm] a
join stuinfobasic b on a.teachclassno=b.classno
where b.stuno='{model.CreateUserNo}'
and a.lessondate between '{startTime}' and '{endTime}'");

// //学生考勤
// StuAttendanceEntity stuAttendanceEntity = new StuAttendanceEntity();
// stuAttendanceEntity.AcademicYearNo = arrangeLessonTerm.AcademicYearNo;
// stuAttendanceEntity.ClassName = classInfoList
// .Where(x => x.ClassNo == arrangeLessonTerm.TeachClassNo).FirstOrDefault()?.ClassName;
// stuAttendanceEntity.ClassNo = arrangeLessonTerm.TeachClassNo;
// stuAttendanceEntity.DeptName = deptList.Where(x => x.DeptNo == arrangeLessonTerm.DeptNo)
// .FirstOrDefault()?.DeptName;
// stuAttendanceEntity.DeptNo = arrangeLessonTerm.DeptNo;
// stuAttendanceEntity.EmpNo = arrangeLessonTerm.EmpNo;
// stuAttendanceEntity.Grade = arrangeLessonTerm.Grade;
// stuAttendanceEntity.InertDate = DateTime.Now;
// stuAttendanceEntity.LessonDate = arrangeLessonTerm.LessonDate;
// stuAttendanceEntity.LessonName = arrangeLessonTerm.LessonName;
// stuAttendanceEntity.LessonNo = arrangeLessonTerm.LessonNo;
// stuAttendanceEntity.LessonSortName = lessonSortList.Find(m => m.LessonSortNo == arrangeLessonTerm.LessonSortNo)?.LessonSortName;
// stuAttendanceEntity.LessonSortNo = arrangeLessonTerm.LessonSortNo;
// stuAttendanceEntity.LessonTime = arrangeLessonTerm.LessonTime;
// stuAttendanceEntity.MajorName = majorList.Where(x => x.MajorNo == arrangeLessonTerm.MajorNo).FirstOrDefault()?.MajorName;
// stuAttendanceEntity.MajorNo = arrangeLessonTerm.MajorNo;
// stuAttendanceEntity.PlanWeek = null;
// stuAttendanceEntity.Semester = arrangeLessonTerm.Semester;
// stuAttendanceEntity.StuName = arrangeLessonTerm.StuName;
// stuAttendanceEntity.StuNo = model.CreateUserNo;
// stuAttendanceEntity.TeachClassNo = arrangeLessonTerm.TeachClassNo;
// stuAttendanceEntity.Sort = "请假";
// stuAttendanceEntity.AttendOrNo = "否";
// stuAttendanceEntity.ClassRoomName = classRoomList.Find(x => x.ClassroomId.Trim() == arrangeLessonTerm.ClassroomNo.Trim())?.ClassroomName.Trim();
// stuAttendanceEntity.ClassRoomNo = arrangeLessonTerm.ClassroomNo;
// stuAttendanceEntity.Gender = arrangeLessonTerm.GenderNo.Trim() == "0" ? "女" : "男";
// stuAttendanceEntity.CheckMarkDept = "";
// stuAttendanceEntity.CheckMark = "";
// stuAttendanceEntity.Create();
// db.Insert(stuAttendanceEntity);
var deptList = this.BaseRepository("CollegeMIS").FindList<CdDeptEntity>();
var majorList = this.BaseRepository("CollegeMIS").FindList<CdMajorEntity>();
var classInfoList = this.BaseRepository("CollegeMIS").FindList<ClassInfoEntity>();
var classRoomList = this.BaseRepository("CollegeMIS").FindList<ClassroomInfoEntity>().ToList();
var lessonSortList = this.BaseRepository("CollegeMIS").FindList<CdLessonSortEntity>().ToList();
foreach (var arrangeLessonTerm in arrangeLessonTermList)
{
StuAttendanceLeaveEntity stuAttendanceLeave = new StuAttendanceLeaveEntity();
stuAttendanceLeave.AcademicYearNo = arrangeLessonTerm.AcademicYearNo;
stuAttendanceLeave.Semester = arrangeLessonTerm.Semester;
stuAttendanceLeave.StuNo = model.CreateUserNo;
stuAttendanceLeave.StuName = arrangeLessonTerm.StuName;
stuAttendanceLeave.Grade = arrangeLessonTerm.Grade;
stuAttendanceLeave.DeptNo = arrangeLessonTerm.DeptNo;
stuAttendanceLeave.DeptName = deptList.Where(x => x.DeptNo == arrangeLessonTerm.DeptNo)
.FirstOrDefault()?.DeptName;
stuAttendanceLeave.MajorNo = arrangeLessonTerm.MajorNo;
stuAttendanceLeave.MajorName = majorList.Where(x => x.MajorNo == arrangeLessonTerm.MajorNo)
.FirstOrDefault()?.MajorName;
stuAttendanceLeave.ClassNo = arrangeLessonTerm.TeachClassNo;
stuAttendanceLeave.ClassName = classInfoList
.Where(x => x.ClassNo == arrangeLessonTerm.TeachClassNo).FirstOrDefault()?.ClassName;
stuAttendanceLeave.LessonNo = arrangeLessonTerm.LessonNo;
stuAttendanceLeave.LessonName = arrangeLessonTerm.LessonName;
stuAttendanceLeave.TeachClassNo = arrangeLessonTerm.TeachClassNo;
stuAttendanceLeave.LessonSortNo = arrangeLessonTerm.LessonSortNo;
stuAttendanceLeave.LessonSortName = lessonSortList.Find(m => m.LessonSortNo == arrangeLessonTerm.LessonSortNo)?.LessonSortName;
stuAttendanceLeave.LessonDate = arrangeLessonTerm.LessonDate;
stuAttendanceLeave.LessonTime = arrangeLessonTerm.LessonTime;
stuAttendanceLeave.LeaveType = entity.LeaveType;
stuAttendanceLeave.EmpNo = arrangeLessonTerm.EmpNo;
stuAttendanceLeave.TecRemark = "按天请假";
stuAttendanceLeave.UpdateDate = DateTime.Now;
stuAttendanceLeave.IsCheck = "1";
stuAttendanceLeave.ClassRoomNo = arrangeLessonTerm.ClassroomNo;
stuAttendanceLeave.ClassRoomName = classRoomList.FirstOrDefault(x => x.ClassroomNo == arrangeLessonTerm.ClassroomNo)?.ClassroomName;
//去重
var isExistModel = this.BaseRepository("CollegeMIS").FindEntity<StuAttendanceLeaveEntity>(x =>
x.AcademicYearNo == stuAttendanceLeave.AcademicYearNo && x.Semester == stuAttendanceLeave.Semester &&
x.StuNo == stuAttendanceLeave.StuNo &&x.LessonNo == stuAttendanceLeave.LessonNo && x.TeachClassNo == stuAttendanceLeave.TeachClassNo &&
x.LessonSortNo == stuAttendanceLeave.LessonSortNo &&x.LessonDate == stuAttendanceLeave.LessonDate && x.LessonTime == stuAttendanceLeave.LessonTime &&
x.EmpNo == stuAttendanceLeave.EmpNo &&x.ClassRoomNo == stuAttendanceLeave.ClassRoomNo
);
if (isExistModel!=null)
{
stuAttendanceLeave.Modify(isExistModel.ID);
db.Update(stuAttendanceLeave);
}
else
{
stuAttendanceLeave.Create();
db.Insert(stuAttendanceLeave);
}
//学生考勤
StuAttendanceEntity stuAttendanceEntity = new StuAttendanceEntity();
stuAttendanceEntity.AcademicYearNo = arrangeLessonTerm.AcademicYearNo;
stuAttendanceEntity.Semester = arrangeLessonTerm.Semester;
stuAttendanceEntity.StuNo = model.CreateUserNo;
stuAttendanceLeave.StuName = arrangeLessonTerm.StuName;
stuAttendanceEntity.Gender = arrangeLessonTerm.GenderNo=="0"?"女":"男";
stuAttendanceEntity.Grade = arrangeLessonTerm.Grade;
stuAttendanceEntity.DeptNo = arrangeLessonTerm.DeptNo;
stuAttendanceEntity.DeptName = deptList.Where(x => x.DeptNo == arrangeLessonTerm.DeptNo)
.FirstOrDefault()?.DeptName;
stuAttendanceEntity.MajorNo = arrangeLessonTerm.MajorNo;
stuAttendanceEntity.MajorName = majorList.Where(x => x.MajorNo == arrangeLessonTerm.MajorNo).FirstOrDefault()?.MajorName;
stuAttendanceEntity.ClassNo = arrangeLessonTerm.TeachClassNo;
stuAttendanceEntity.ClassName = classInfoList
.Where(x => x.ClassNo == arrangeLessonTerm.TeachClassNo).FirstOrDefault()?.ClassName;
stuAttendanceEntity.LessonNo = arrangeLessonTerm.LessonNo;
stuAttendanceEntity.LessonName = arrangeLessonTerm.LessonName;
stuAttendanceEntity.TeachClassNo = arrangeLessonTerm.TeachClassNo;
stuAttendanceEntity.LessonSortNo = arrangeLessonTerm.LessonSortNo;
stuAttendanceEntity.LessonSortName = lessonSortList.Find(m => m.LessonSortNo == arrangeLessonTerm.LessonSortNo)?.LessonSortName;
stuAttendanceEntity.LessonDate = arrangeLessonTerm.LessonDate;
stuAttendanceEntity.PlanWeek = null;
stuAttendanceEntity.LessonTime = arrangeLessonTerm.LessonTime;
stuAttendanceEntity.AttendOrNo = "否";
stuAttendanceEntity.Sort = Convert.ToInt32(entity.LeaveType) == 2 ? "病假" : "事假";
stuAttendanceEntity.EmpNo = arrangeLessonTerm.EmpNo;
stuAttendanceEntity.Remark = "按天请假";
stuAttendanceEntity.CheckMarkDept = "";
stuAttendanceEntity.CheckMark = "";
stuAttendanceEntity.InertDate = DateTime.Now;
stuAttendanceEntity.ClassRoomNo = arrangeLessonTerm.ClassroomNo;
stuAttendanceEntity.ClassRoomName = classRoomList.FirstOrDefault(x => x.ClassroomNo == arrangeLessonTerm.ClassroomNo)?.ClassroomName;
//去重
var isExistModel2 = this.BaseRepository("CollegeMIS").FindEntity<StuAttendanceEntity>(x =>
x.AcademicYearNo == stuAttendanceEntity.AcademicYearNo && x.Semester == stuAttendanceEntity.Semester && x.StuNo == stuAttendanceEntity.StuNo &&
x.LessonNo == stuAttendanceEntity.LessonNo && x.TeachClassNo == stuAttendanceEntity.TeachClassNo && x.LessonSortNo == stuAttendanceEntity.LessonSortNo &&
x.LessonDate == stuAttendanceEntity.LessonDate && x.LessonTime == stuAttendanceEntity.LessonTime && x.EmpNo == stuAttendanceEntity.EmpNo && x.ClassRoomNo == stuAttendanceEntity.ClassRoomNo);
if (isExistModel2 != null)
{
stuAttendanceEntity.Modify(isExistModel2.ID);
db.Update(stuAttendanceEntity);
}
else
{
stuAttendanceEntity.Create();
db.Insert(stuAttendanceEntity);
}

// }
// }
}
}
}
else
{


Cargando…
Cancelar
Guardar