1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Text;
- using System.Transactions;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.Utility;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.EducationManagement;
- using EMIS.ViewModel.CultureplanManage.PlanManagement;
- namespace EMIS.ExtensionLogic.CommonLogic.EducationManage
- {
- public class ExecutablePlanServices : EMIS.CommonLogic.EducationManage.ExecutablePlanServices
- {
- /// <summary>
- /// 编辑(新增、修改,业务主键:学年学期ID、年级专业ID、课程信息ID)
- /// 注:关联对应的专业计划、刷新相关的教学任务信息
- /// 注:区分普教版本(年级专业)、成教版本(入学学年学期、专业信息)
- /// 注:此为成教版本(入学学年学期、专业信息)
- /// 注:此版本学生人数小于等于0时,不可提交,但由于有异动的情况,需进一步优化逻辑(对教学任务班学生名单进行判断)
- /// </summary>
- /// <param name="executablePlanView"></param>
- public override void ExecutablePlanEdit(ExecutablePlanView executablePlanView)
- {
- try
- {
- //查询对应的课程信息
- var coursematerial = ExecutablePlanDAL.CoursematerialRepository.GetList(x => x.CoursematerialID == executablePlanView.CoursematerialID).SingleOrDefault();
- if (coursematerial == null)
- {
- throw new Exception("课程信息不存在,请检查。");
- }
- //查询对应的年级专业信息
- var grademajor = ExecutablePlanDAL.GrademajorRepository
- .GetList(x => x.GrademajorID == executablePlanView.GrademajorID).SingleOrDefault();
- if (grademajor == null)
- {
- throw new Exception("年级专业信息不存在,请检查。");
- }
- //查询年级专业对应的专业信息
- var specialty = ExecutablePlanDAL.GetSpecialtyQueryable(x => x.GrademajorID == executablePlanView.GrademajorID).SingleOrDefault();
- if (specialty == null)
- {
- throw new Exception("年级专业对应的专业信息不存在,请检查。");
- }
- //查询年级专业对应的入学学年学期信息
- var startSchoolyear = ExecutablePlanDAL.SchoolyearRepository.GetList(x => x.Years == grademajor.GradeID && x.SchoolcodeID == grademajor.SemesterID).SingleOrDefault();
- if (startSchoolyear == null)
- {
- throw new Exception("年级专业对应的入学学年学期信息不存在,请检查。");
- }
- //查询年级专业对应的毕业学年学期信息
- var graduatingSemester = ExecutablePlanDAL.SchoolyearRepository.GetList(x => x.SchoolyearID == grademajor.GraduateSchoolyearID).SingleOrDefault();
- if (graduatingSemester == null)
- {
- throw new Exception("年级专业对应的毕业学年学期信息不存在,请检查。");
- }
- //查询对应的学年学期信息
- var schoolyear = ExecutablePlanDAL.SchoolyearRepository.GetList(x => x.SchoolyearID == executablePlanView.SchoolyearID).SingleOrDefault();
- if (schoolyear == null)
- {
- throw new Exception("学年学期信息不存在,请检查。");
- }
- if (schoolyear.Value < startSchoolyear.Value)
- {
- throw new Exception("学年学期小于入学学年学期,请检查。");
- }
- if (schoolyear.Value > graduatingSemester.Value)
- {
- throw new Exception("学年学期大于毕业学年学期,请检查。");
- }
- //查询数据库进行验证
- var executablePlanVerify = ExecutablePlanDAL.ExecutablePlanRepository
- .GetList(x => x.ExecutablePlanID != executablePlanView.ExecutablePlanID
- && x.SchoolyearID == executablePlanView.SchoolyearID
- && x.GrademajorID == executablePlanView.GrademajorID
- && x.CoursematerialID == executablePlanView.CoursematerialID).SingleOrDefault();
- if (executablePlanVerify == null)
- {
- if (executablePlanView.TeachingModeIDList == null || executablePlanView.TeachingModeIDList.Count() <= 0)
- {
- throw new Exception("请选择至少一种授课方式,请检查。");
- }
- //查询对应的专业计划信息(业务主键:学年学期ID、入学学年学期ID、专业信息ID、课程信息ID)
- var specialtyPlan = ExecutablePlanDAL.SpecialtyPlanRepository
- .GetList(x => x.SchoolyearID == executablePlanView.SchoolyearID
- && x.StartSchoolyearID == startSchoolyear.SchoolyearID
- && x.SpecialtyID == specialty.SpecialtyID
- && x.CoursematerialID == executablePlanView.CoursematerialID).SingleOrDefault();
- List<EM_ExecutablePlan> newExecutablePlanInList = new List<EM_ExecutablePlan>();
- List<EM_ExecutablePlan> newExecutablePlanUpList = new List<EM_ExecutablePlan>();
- List<EM_ExecutablePlanProfile> newProfileInList = new List<EM_ExecutablePlanProfile>();
- List<EM_ExecutablePlanProfile> newProfileUpList = new List<EM_ExecutablePlanProfile>();
- List<EM_ExecutablePlanTeachingSetting> newEPTeachingSettingInList = new List<EM_ExecutablePlanTeachingSetting>();
- List<EM_ExecutablePlanTeachingSetting> newEPTeachingSettingUpList = new List<EM_ExecutablePlanTeachingSetting>();
- List<EM_ExecutablePlanTeachingModeType> newEPTeachingModeTypeInList = new List<EM_ExecutablePlanTeachingModeType>();
- List<EM_ExecutablePlanTeachingPlace> newEPTeachingPlaceInList = new List<EM_ExecutablePlanTeachingPlace>();
- List<Guid?> executablePlanTMDelList = new List<Guid?>();
- List<Guid?> executablePlanTPDelList = new List<Guid?>();
- List<EM_EducationMission> newEducationMissionInList = new List<EM_EducationMission>();
- List<EM_EducationMission> newEducationMissionUpList = new List<EM_EducationMission>();
- List<EM_EducationMissionClass> newEducationMissionClassInList = new List<EM_EducationMissionClass>();
- List<EM_EducationMissionClass> newEducationMissionClassUpList = new List<EM_EducationMissionClass>();
- List<EM_EducationMissionClassTeachingSetting> newEduTeachingSettingInList = new List<EM_EducationMissionClassTeachingSetting>();
- List<EM_EducationMissionClassTeachingSetting> newEduTeachingSettingUpList = new List<EM_EducationMissionClassTeachingSetting>();
- List<EM_EducationSchedulingClass> newEducationSchedulingClassInList = new List<EM_EducationSchedulingClass>();
- List<EM_EducationMissionClassSettings> newEduSettingsInList = new List<EM_EducationMissionClassSettings>();
- List<EM_CourseProcess> newCourseProcessInList = new List<EM_CourseProcess>();
- //数据有误验证
- if (executablePlanView.ExecutablePlanID != Guid.Empty)
- {
- var executablePlan = ExecutablePlanDAL.ExecutablePlanRepository
- .GetList(x => x.ExecutablePlanID == executablePlanView.ExecutablePlanID,
- (x => x.EM_ExecutablePlanProfile), (x => x.EM_ExecutablePlanTeachingSetting)).SingleOrDefault();
- if (executablePlan == null)
- {
- throw new Exception("数据有误,请核查。");
- }
- else
- {
- //表示修改
- executablePlan.SourceTypeID = executablePlanView.SourceTypeID;
- executablePlan.DefaultClassName = coursematerial.CourseName + "-" + grademajor.Name;
- if (specialtyPlan == null)
- {
- executablePlan.SpecialtyPlanID = null;
- }
- else
- {
- executablePlan.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
- }
- executablePlan.SchoolyearID = executablePlanView.SchoolyearID;
- executablePlan.GrademajorID = executablePlanView.GrademajorID;
- executablePlan.CoursematerialID = executablePlanView.CoursematerialID;
- executablePlan.CourseStructureID = executablePlanView.CourseStructureID;
- executablePlan.CourseCategoryID = executablePlanView.CourseCategoryID;
- executablePlan.CourseTypeID = executablePlanView.CourseTypeID;
- executablePlan.CourseQualityID = executablePlanView.CourseQualityID;
- executablePlan.DepartmentID = executablePlanView.DepartmentID;
- if (executablePlanView.PlanTypeID == (int)EM_PlanType.Outside)
- {
- executablePlan.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- }
- executablePlan.ResultTypeID = executablePlanView.ResultTypeID;
- executablePlan.HandleModeID = executablePlanView.HandleModeID;
- SetModifyStatus(executablePlan);
- newExecutablePlanUpList.Add(executablePlan);
- if (executablePlan.EM_ExecutablePlanProfile == null)
- {
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newProfile.IsSpecialtycore = executablePlanView.IsSpecialtycore;
- newProfile.IsCooperation = executablePlanView.IsCooperation;
- newProfile.IsRequired = executablePlanView.IsRequired;
- newProfile.IsElective = executablePlanView.IsElective;
- newProfile.IsNetworkCourse = executablePlanView.IsNetworkCourse;
- newProfile.IsMainCourse = executablePlanView.IsMainCourse;
- newProfile.CourseFineID = executablePlanView.CourseFineID;
- newProfile.PracticeTypeID = executablePlanView.PracticeTypeID;
- newProfile.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- newProfile.ExaminationModeID = executablePlanView.ExaminationModeID;
- SetNewStatus(newProfile);
- newProfileInList.Add(newProfile);
- }
- else
- {
- if (executablePlanView.PlanTypeID == (int)EM_PlanType.Outside)
- {
- executablePlan.EM_ExecutablePlanProfile.IsSpecialtycore = executablePlanView.IsSpecialtycore;
- executablePlan.EM_ExecutablePlanProfile.IsCooperation = executablePlanView.IsCooperation;
- executablePlan.EM_ExecutablePlanProfile.IsRequired = executablePlanView.IsRequired;
- executablePlan.EM_ExecutablePlanProfile.IsElective = executablePlanView.IsElective;
- executablePlan.EM_ExecutablePlanProfile.IsNetworkCourse = executablePlanView.IsNetworkCourse;
- executablePlan.EM_ExecutablePlanProfile.IsMainCourse = executablePlanView.IsMainCourse;
- executablePlan.EM_ExecutablePlanProfile.CourseFineID = executablePlanView.CourseFineID;
- executablePlan.EM_ExecutablePlanProfile.PracticeTypeID = executablePlanView.PracticeTypeID;
- executablePlan.EM_ExecutablePlanProfile.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- executablePlan.EM_ExecutablePlanProfile.ExaminationModeID = executablePlanView.ExaminationModeID;
- }
- SetModifyStatus(executablePlan.EM_ExecutablePlanProfile);
- newProfileUpList.Add(executablePlan.EM_ExecutablePlanProfile);
- }
- if (executablePlan.EM_ExecutablePlanTeachingSetting == null)
- {
- var newEPTeachingSetting = new EM_ExecutablePlanTeachingSetting();
- newEPTeachingSetting.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingSetting.Credit = executablePlanView.Credit;
- newEPTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- newEPTeachingSetting.Practicehours = executablePlanView.Practicehours;
- newEPTeachingSetting.Trialhours = executablePlanView.Trialhours;
- newEPTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- newEPTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- newEPTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- newEPTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- newEPTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- newEPTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- newEPTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEPTeachingSettingInList.Add(newEPTeachingSetting);
- }
- else
- {
- if (executablePlanView.PlanTypeID == (int)EM_PlanType.Outside)
- {
- executablePlan.EM_ExecutablePlanTeachingSetting.Credit = executablePlanView.Credit;
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- executablePlan.EM_ExecutablePlanTeachingSetting.Practicehours = executablePlanView.Practicehours;
- executablePlan.EM_ExecutablePlanTeachingSetting.Trialhours = executablePlanView.Trialhours;
- }
- executablePlan.EM_ExecutablePlanTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- executablePlan.EM_ExecutablePlanTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- executablePlan.EM_ExecutablePlanTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEPTeachingSettingUpList.Add(executablePlan.EM_ExecutablePlanTeachingSetting);
- }
- if (executablePlanView.TeachingModeIDList != null && executablePlanView.TeachingModeIDList.Count() > 0)
- {
- executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newModeType in executablePlanView.TeachingModeIDList.ToList())
- {
- var newEPTeachingModeType = new EM_ExecutablePlanTeachingModeType();
- newEPTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
- newEPTeachingModeType.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newEPTeachingModeType);
- newEPTeachingModeTypeInList.Add(newEPTeachingModeType);
- }
- }
- else
- {
- executablePlanTMDelList.Add(executablePlan.ExecutablePlanID);
- }
- if (executablePlanView.TeachingPlaceIDList != null && executablePlanView.TeachingPlaceIDList.Count() > 0)
- {
- executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
- foreach (var newPlace in executablePlanView.TeachingPlaceIDList.ToList())
- {
- var newEPTeachingPlace = new EM_ExecutablePlanTeachingPlace();
- newEPTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
- newEPTeachingPlace.ExecutablePlanID = executablePlan.ExecutablePlanID;
- newEPTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newEPTeachingPlace);
- newEPTeachingPlaceInList.Add(newEPTeachingPlace);
- }
- }
- else
- {
- executablePlanTPDelList.Add(executablePlan.ExecutablePlanID);
- }
- //对应的教学任务信息更新(根据业务主键:学年学期ID、课程信息ID、班级信息ID、排课任务班ID或教学任务班ID)
- //注:由于相关业务主键冗余,目前不允许修改相关业务主键
- //教学任务班生成规则如下:
- //1、对应的授课方式为必选项且可多选;
- //2、课程信息对应的上课类型为空时,默认只生成一种类型的教学任务班(授课方式为最小Value授课方式);
- //3、以上课类型为标准,匹配对应的授课方式来生成教学任务班;
- //4、根据授课方式与上课类型查询是否分班情况,存在分班情况,则生成对应的教学任务班;
- //5、对应的授课方式存在分班情况时,默认生成成绩合并录入形式的教学任务班(同一条教学任务);
- //6、年级专业对应的计划范围不于等于0时,不生成对应的教学任务班(无法生成);
- //7、年级专业对应的学生人数小于等于0时,不生成对应的教学任务班(成教版本有此逻辑);
- //8、如对应的年级专业有多个班级,都生成对应的教学任务班(只取在校状态为在校的学生信息);
- if (executablePlan.RecordStatus == (int)EM_ExecuteStatus.Submited)
- {
- //年级专业
- Expression<Func<CF_Grademajor, bool>> expGrademajor = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expGrademajor = expGrademajor.And(x => x.GrademajorID == executablePlanView.GrademajorID);
- //查询对应的班级范围信息classmajorList
- var classmajorList = ExecutablePlanDAL.GetClassmajorRangeQueryable(expGrademajor).ToList();
- //执行计划对应的计划范围判断
- if (classmajorList != null && classmajorList.Count() > 0)
- {
- //查询对应的学生范围信息studentList
- var studentList = ExecutablePlanDAL.GetStudentRangeQueryable(expGrademajor).ToList();
- //执行计划对应的学生范围判断
- if (studentList != null && studentList.Count() > 0)
- {
- //查询对应在校状态IDList
- var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
- //查询对应的课程信息中授课方式分班信息List
- var separateModeTypeList = ExecutablePlanDAL.GetSeparateModeTypeQueryble(x => x.CoursematerialID == executablePlanView.CoursematerialID).ToList();
- //查询授课方式teachingModeList
- var teachingModeList = DictionaryHelper.GetDictionaryValue(EMIS.ViewModel.DictionaryItem.CF_TeachingMode).ToList();
- //查询执行计划中授课方式及对应的上课类型中的授课方式(匹配上课类型)
- var minTeachingModeID = executablePlanView.TeachingModeIDList
- .Where(x => !separateModeTypeList.Contains(x)).OrderBy(x => x).FirstOrDefault();
- List<int?> teachingModeIDList = new List<int?>();
- if (minTeachingModeID != null)
- {
- teachingModeIDList.Add(minTeachingModeID);
- teachingModeIDList = teachingModeIDList.Concat(executablePlanView.TeachingModeIDList
- .Where(x => separateModeTypeList.Contains(x))).GroupBy(x => x).Select(x => x.Key).ToList();
- }
- else
- {
- teachingModeIDList = executablePlanView.TeachingModeIDList
- .Where(x => separateModeTypeList.Contains(x)).GroupBy(x => x).Select(x => x.Key).ToList();
- }
- //查询对应的授课方式信息List(匹配上课类型)
- var epTeachingModeList = teachingModeList.Where(x => teachingModeIDList.Contains(x.Value)).ToList();
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expExecutablePlan = expExecutablePlan.And(x => x.ExecutablePlanID == executablePlanView.ExecutablePlanID);
- //查询对应的教学任务班信息(业务主键:学年学期ID、课程信息ID、班级信息ID、排课任务班ID或教学任务班ID)
- var educationMissionClassList = ExecutablePlanDAL.GetEducationMissionClassQueryable(expExecutablePlan).ToList();
- foreach (var classmajor in classmajorList)
- {
- //查询班级信息对应的教学任务班信息List
- var educlList = educationMissionClassList.Where(x => x.CF_Classmajor
- .Any(w => w.ClassmajorID == classmajor.ClassmajorID)).ToList();
- if (educlList != null && educlList.Count() > 0)
- {
- //表示存在对应的教学任务班
- //根据教学任务ID对educlList进行分组
- var edugrList = educlList.GroupBy(x => x.EducationMissionID).ToList();
- //根据授课方式对educlList进行分组
- var tmgrList = educlList.GroupBy(x => x.TeachingModeID).ToList();
- if (edugrList.Count() > 1 && tmgrList.Count() > 1)
- {
- //表示对应的教学任务班存在分班且成绩分开录入、授课方式多种情况
- //目前此种数据有误,在生成期末设定时有问题(这里暂不处理)
- throw new Exception("对应的教学任务班中存在分班且成绩分开录入、授课方式多种的信息(请删除后,再保存),请核查。");
- }
- else if (edugrList.Count() > 1 && epTeachingModeList.Count() > 1)
- {
- //表示对应的教学任务班存在分班且成绩分开录入、授课方式只有一种情况,不可再生成多种授课方式的教学任务班信息
- //目前此种数据有误,在生成期末设定时有问题
- throw new Exception("对应的教学任务班中存在分班且成绩分开录入的信息,不可再生成多种授课方式的教学任务班信息(请删除后,再保存),请核查。");
- }
- else if (tmgrList.Count() == 1 && epTeachingModeList.Count() == 1)
- {
- //表示对应的教学任务班只存在一种授课方式信息(含分班且成绩合并或分开录入)
- //同时生成的教学任务班信息授课方式只有一种的情况(直接修改)
- foreach (var educl in educlList)
- {
- if (!newEducationMissionUpList.Any(x => x.EducationMissionID == educl.EducationMissionID))
- {
- educl.EM_EducationMission.ClassName = coursematerial.CourseName + "-" + classmajor.Name;
- educl.EM_EducationMission.SchoolyearID = executablePlanView.SchoolyearID;
- educl.EM_EducationMission.CollegeID = executablePlanView.CollegeID;
- educl.EM_EducationMission.DepartmentID = executablePlanView.DepartmentID;
- SetModifyStatus(educl.EM_EducationMission);
- newEducationMissionUpList.Add(educl.EM_EducationMission);
- }
- if (!newEducationMissionClassUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- educl.CoursematerialID = executablePlanView.CoursematerialID;
- educl.CourseStructureID = executablePlanView.CourseStructureID;
- educl.CourseCategoryID = executablePlanView.CourseCategoryID;
- educl.CourseTypeID = executablePlanView.CourseTypeID;
- educl.CourseQualityID = executablePlanView.CourseQualityID;
- educl.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- educl.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- educl.ExaminationModeID = executablePlanView.ExaminationModeID;
- educl.ResultTypeID = executablePlanView.ResultTypeID;
- educl.HandleModeID = executablePlanView.HandleModeID;
- educl.TeachingModeID = epTeachingModeList[0].Value;
- SetModifyStatus(educl);
- newEducationMissionClassUpList.Add(educl);
- }
- if (!newEduTeachingSettingUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.EM_EducationMissionClassTeachingSetting.Credit = executablePlanView.Credit;
- educl.EM_EducationMissionClassTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- educl.EM_EducationMissionClassTeachingSetting.Practicehours = executablePlanView.Practicehours;
- educl.EM_EducationMissionClassTeachingSetting.Trialhours = executablePlanView.Trialhours;
- //if (educl.RecordStatus != (int)EM_EducationMissionClassStatus.Submitted || educl.RecordStatus != (int)EM_EducationMissionClassStatus.Scheduled)
- //{
- // //暂不考虑
- // educl.EM_EducationMissionClassTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- //}
- newEduTeachingSettingUpList.Add(educl.EM_EducationMissionClassTeachingSetting);
- }
- }
- }
- else
- {
- //表示无论分班与否,成绩都是合并录入的情况(同一个教学任务ID)
- //表示可根据执行计划中匹配上课类型后的授课方式进行增加、修改对应的教学任务班信息
- foreach (var educl in educlList)
- {
- //修改
- if (!newEducationMissionUpList.Any(x => x.EducationMissionID == educl.EducationMissionID))
- {
- educl.EM_EducationMission.ClassName = coursematerial.CourseName + "-" + classmajor.Name;
- educl.EM_EducationMission.SchoolyearID = executablePlanView.SchoolyearID;
- educl.EM_EducationMission.CollegeID = executablePlanView.CollegeID;
- educl.EM_EducationMission.DepartmentID = executablePlanView.DepartmentID;
- SetModifyStatus(educl.EM_EducationMission);
- newEducationMissionUpList.Add(educl.EM_EducationMission);
- }
- if (!newEducationMissionClassUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- educl.CoursematerialID = executablePlanView.CoursematerialID;
- educl.CourseStructureID = executablePlanView.CourseStructureID;
- educl.CourseCategoryID = executablePlanView.CourseCategoryID;
- educl.CourseTypeID = executablePlanView.CourseTypeID;
- educl.CourseQualityID = executablePlanView.CourseQualityID;
- educl.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- educl.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- educl.ExaminationModeID = executablePlanView.ExaminationModeID;
- educl.ResultTypeID = executablePlanView.ResultTypeID;
- educl.HandleModeID = executablePlanView.HandleModeID;
- SetModifyStatus(educl);
- newEducationMissionClassUpList.Add(educl);
- }
- if (!newEduTeachingSettingUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.EM_EducationMissionClassTeachingSetting.Credit = executablePlanView.Credit;
- educl.EM_EducationMissionClassTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- educl.EM_EducationMissionClassTeachingSetting.Practicehours = executablePlanView.Practicehours;
- educl.EM_EducationMissionClassTeachingSetting.Trialhours = executablePlanView.Trialhours;
- //if (educl.RecordStatus != (int)EM_EducationMissionClassStatus.Submitted || educl.RecordStatus != (int)EM_EducationMissionClassStatus.Scheduled)
- //{
- // //暂不考虑
- // educl.EM_EducationMissionClassTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- //}
- newEduTeachingSettingUpList.Add(educl.EM_EducationMissionClassTeachingSetting);
- }
- }
- //将执行计划中匹配上课类型后的授课方式与对应的教学任务班的授课方式进行对比
- var educltmList = tmgrList.Select(x => x.Key).ToList();
- var newTeachingModeList = epTeachingModeList.Where(x => !educltmList.Contains(x.Value)).ToList();
- foreach (var newTeachingMode in newTeachingModeList)
- {
- //新增
- var newEducationMissionClass = new EM_EducationMissionClass();
- newEducationMissionClass.EducationMissionClassID = Guid.NewGuid();
- newEducationMissionClass.EducationMissionID = edugrList[0].Key;
- newEducationMissionClass.MainScheduleClassID = classmajor.ClassmajorID;
- newEducationMissionClass.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- newEducationMissionClass.OrderNo = classmajor.ClassNum ?? 1;
- newEducationMissionClass.Name = coursematerial.CourseName + "-" + classmajor.Name + "-(" + newTeachingMode.Name + ")";
- newEducationMissionClass.CoursematerialID = executablePlanView.CoursematerialID;
- newEducationMissionClass.CourseStructureID = executablePlanView.CourseStructureID;
- newEducationMissionClass.CourseCategoryID = executablePlanView.CourseCategoryID;
- newEducationMissionClass.CourseTypeID = executablePlanView.CourseTypeID;
- newEducationMissionClass.CourseQualityID = executablePlanView.CourseQualityID;
- newEducationMissionClass.ClassroomTypeID = null;
- newEducationMissionClass.ClassroomID = null;
- newEducationMissionClass.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- newEducationMissionClass.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- newEducationMissionClass.ExaminationModeID = executablePlanView.ExaminationModeID;
- newEducationMissionClass.ResultTypeID = executablePlanView.ResultTypeID;
- newEducationMissionClass.HandleModeID = executablePlanView.HandleModeID;
- newEducationMissionClass.TeachingModeID = newTeachingMode.Value;
- newEducationMissionClass.Remark = coursematerial.CourseName + "-" + classmajor.Name + "-(" + newTeachingMode.Name + ")";
- SetNewStatus(newEducationMissionClass, (int)EM_EducationMissionClassStatus.NotSubmitted);
- newEducationMissionClassInList.Add(newEducationMissionClass);
- var newEduTeachingSetting = new EM_EducationMissionClassTeachingSetting();
- newEduTeachingSetting.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduTeachingSetting.Credit = executablePlanView.Credit;
- newEduTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- newEduTeachingSetting.Practicehours = executablePlanView.Practicehours;
- newEduTeachingSetting.Trialhours = executablePlanView.Trialhours;
- newEduTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- newEduTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- newEduTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- newEduTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- newEduTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- newEduTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- newEduTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEduTeachingSettingInList.Add(newEduTeachingSetting);
- newEducationMissionClass.CF_Classmajor = new HashSet<CF_Classmajor>();
- newEducationMissionClass.CF_Classmajor.Add(classmajor);
- var newEducationSchedulingClass = new EM_EducationSchedulingClass();
- newEducationSchedulingClass.EducationSchedulingClassID = Guid.NewGuid();
- newEducationSchedulingClass.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationSchedulingClass.TaskGroupName = "1组";
- newEducationSchedulingClass.Remark = classmajor.Name;
- SetNewStatus(newEducationSchedulingClass);
- newEducationSchedulingClassInList.Add(newEducationSchedulingClass);
- newEducationSchedulingClass.CF_Student = new HashSet<CF_Student>();
- var newStudent = studentList.Where(x => x.ClassmajorID == classmajor.ClassmajorID
- && inschoolStatusList.Contains(x.InSchoolStatusID)).ToList();
- newStudent.ForEach(x => newEducationSchedulingClass.CF_Student.Add(x));
- for (int i = 0; i < executablePlanView.EndWeeklyNum; i++)
- {
- var newEduSettings = new EM_EducationMissionClassSettings();
- newEduSettings.EducationMissionClassSettingsID = Guid.NewGuid();
- newEduSettings.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduSettings.WeeklyNum = i + 1;
- SetNewStatus(newEduSettings);
- newEduSettingsInList.Add(newEduSettings);
- var newCourseProcess = new EM_CourseProcess();
- newCourseProcess.CourseProcessID = Guid.NewGuid();
- newCourseProcess.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newCourseProcess.Week = i + 1;
- newCourseProcess.Times = executablePlanView.WeeklyHours;
- newCourseProcessInList.Add(newCourseProcess);
- }
- }
- }
- }
- else
- {
- //表示不存在对应的教学任务班(新增)
- var newEducationMission = new EM_EducationMission();
- newEducationMission.EducationMissionID = Guid.NewGuid();
- newEducationMission.ClassName = coursematerial.CourseName + "-" + classmajor.Name;
- newEducationMission.SchoolyearID = executablePlanView.SchoolyearID;
- newEducationMission.CollegeID = executablePlanView.CollegeID;
- newEducationMission.DepartmentID = executablePlanView.DepartmentID;
- SetNewStatus(newEducationMission);
- newEducationMissionInList.Add(newEducationMission);
- foreach (var epTeachingMode in epTeachingModeList)
- {
- var newEducationMissionClass = new EM_EducationMissionClass();
- newEducationMissionClass.EducationMissionClassID = Guid.NewGuid();
- newEducationMissionClass.EducationMissionID = newEducationMission.EducationMissionID;
- newEducationMissionClass.MainScheduleClassID = classmajor.ClassmajorID;
- newEducationMissionClass.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- newEducationMissionClass.OrderNo = classmajor.ClassNum ?? 1;
- newEducationMissionClass.Name = coursematerial.CourseName + "-" + classmajor.Name + "-(" + epTeachingMode.Name + ")";
- newEducationMissionClass.CoursematerialID = executablePlanView.CoursematerialID;
- newEducationMissionClass.CourseStructureID = executablePlanView.CourseStructureID;
- newEducationMissionClass.CourseCategoryID = executablePlanView.CourseCategoryID;
- newEducationMissionClass.CourseTypeID = executablePlanView.CourseTypeID;
- newEducationMissionClass.CourseQualityID = executablePlanView.CourseQualityID;
- newEducationMissionClass.ClassroomTypeID = null;
- newEducationMissionClass.ClassroomID = null;
- newEducationMissionClass.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- newEducationMissionClass.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- newEducationMissionClass.ExaminationModeID = executablePlanView.ExaminationModeID;
- newEducationMissionClass.ResultTypeID = executablePlanView.ResultTypeID;
- newEducationMissionClass.HandleModeID = executablePlanView.HandleModeID;
- newEducationMissionClass.TeachingModeID = epTeachingMode.Value;
- newEducationMissionClass.Remark = coursematerial.CourseName + "-" + classmajor.Name + "-(" + epTeachingMode.Name + ")";
- SetNewStatus(newEducationMissionClass, (int)EM_EducationMissionClassStatus.NotSubmitted);
- newEducationMissionClassInList.Add(newEducationMissionClass);
- var newEduTeachingSetting = new EM_EducationMissionClassTeachingSetting();
- newEduTeachingSetting.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduTeachingSetting.Credit = executablePlanView.Credit;
- newEduTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- newEduTeachingSetting.Practicehours = executablePlanView.Practicehours;
- newEduTeachingSetting.Trialhours = executablePlanView.Trialhours;
- newEduTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- newEduTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- newEduTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- newEduTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- newEduTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- newEduTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- newEduTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEduTeachingSettingInList.Add(newEduTeachingSetting);
- newEducationMissionClass.CF_Classmajor = new HashSet<CF_Classmajor>();
- newEducationMissionClass.CF_Classmajor.Add(classmajor);
- var newEducationSchedulingClass = new EM_EducationSchedulingClass();
- newEducationSchedulingClass.EducationSchedulingClassID = Guid.NewGuid();
- newEducationSchedulingClass.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationSchedulingClass.TaskGroupName = "1组";
- newEducationSchedulingClass.Remark = classmajor.Name;
- SetNewStatus(newEducationSchedulingClass);
- newEducationSchedulingClassInList.Add(newEducationSchedulingClass);
- newEducationSchedulingClass.CF_Student = new HashSet<CF_Student>();
- var newStudent = studentList.Where(x => x.ClassmajorID == classmajor.ClassmajorID
- && inschoolStatusList.Contains(x.InSchoolStatusID)).ToList();
- newStudent.ForEach(x => newEducationSchedulingClass.CF_Student.Add(x));
- for (int i = 0; i < executablePlanView.EndWeeklyNum; i++)
- {
- var newEduSettings = new EM_EducationMissionClassSettings();
- newEduSettings.EducationMissionClassSettingsID = Guid.NewGuid();
- newEduSettings.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduSettings.WeeklyNum = i + 1;
- SetNewStatus(newEduSettings);
- newEduSettingsInList.Add(newEduSettings);
- var newCourseProcess = new EM_CourseProcess();
- newCourseProcess.CourseProcessID = Guid.NewGuid();
- newCourseProcess.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newCourseProcess.Week = i + 1;
- newCourseProcess.Times = executablePlanView.WeeklyHours;
- newCourseProcessInList.Add(newCourseProcess);
- }
- }
- }
- }
- }
- else
- {
- //表示执行计划对应的学生范围不存在(小于等于0)
- //throw new Exception("执行计划对应的学生范围不存在(小于等于0),请核查。");
- }
- }
- else
- {
- //表示执行计划对应的计划范围不存在(小于等于0)
- //throw new Exception("执行计划对应的计划范围不存在(小于等于0),请核查。");
- }
- }
- else
- {
- //表示未提交
- //暂不考虑对相关教学任务信息的处理
- }
- }
- }
- else
- {
- //表示新增
- var newExecutablePlan = new EM_ExecutablePlan();
- newExecutablePlan.ExecutablePlanID = Guid.NewGuid();
- newExecutablePlan.SourceTypeID = executablePlanView.SourceTypeID;
- newExecutablePlan.DefaultClassName = coursematerial.CourseName + "-" + grademajor.Name;
- if (specialtyPlan == null)
- {
- newExecutablePlan.SpecialtyPlanID = null;
- }
- else
- {
- newExecutablePlan.SpecialtyPlanID = specialtyPlan.SpecialtyPlanID;
- }
- newExecutablePlan.SchoolyearID = executablePlanView.SchoolyearID;
- newExecutablePlan.GrademajorID = executablePlanView.GrademajorID;
- newExecutablePlan.CoursematerialID = executablePlanView.CoursematerialID;
- newExecutablePlan.CourseStructureID = executablePlanView.CourseStructureID;
- newExecutablePlan.CourseCategoryID = executablePlanView.CourseCategoryID;
- newExecutablePlan.CourseTypeID = executablePlanView.CourseTypeID;
- newExecutablePlan.CourseQualityID = executablePlanView.CourseQualityID;
- newExecutablePlan.DepartmentID = executablePlanView.DepartmentID;
- newExecutablePlan.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- newExecutablePlan.ResultTypeID = executablePlanView.ResultTypeID;
- newExecutablePlan.HandleModeID = executablePlanView.HandleModeID;
- newExecutablePlan.Remark = executablePlanView.Remark;
- SetNewStatus(newExecutablePlan, (int)EM_ExecuteStatus.NotSubmited);
- newExecutablePlanInList.Add(newExecutablePlan);
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newProfile.IsSpecialtycore = executablePlanView.IsSpecialtycore;
- newProfile.IsCooperation = executablePlanView.IsCooperation;
- newProfile.IsRequired = executablePlanView.IsRequired;
- newProfile.IsElective = executablePlanView.IsElective;
- newProfile.IsNetworkCourse = executablePlanView.IsNetworkCourse;
- newProfile.IsMainCourse = executablePlanView.IsMainCourse;
- newProfile.CourseFineID = executablePlanView.CourseFineID;
- newProfile.PracticeTypeID = executablePlanView.PracticeTypeID;
- newProfile.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- newProfile.ExaminationModeID = executablePlanView.ExaminationModeID;
- SetNewStatus(newProfile);
- newProfileInList.Add(newProfile);
- var newEPTeachingSetting = new EM_ExecutablePlanTeachingSetting();
- newEPTeachingSetting.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newEPTeachingSetting.Credit = executablePlanView.Credit;
- newEPTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- newEPTeachingSetting.Practicehours = executablePlanView.Practicehours;
- newEPTeachingSetting.Trialhours = executablePlanView.Trialhours;
- newEPTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- newEPTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- newEPTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- newEPTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- newEPTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- newEPTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- newEPTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEPTeachingSettingInList.Add(newEPTeachingSetting);
- if (executablePlanView.TeachingModeIDList != null && executablePlanView.TeachingModeIDList.Count() > 0)
- {
- foreach (var newModeType in executablePlanView.TeachingModeIDList.ToList())
- {
- var newEPTeachingModeType = new EM_ExecutablePlanTeachingModeType();
- newEPTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
- newEPTeachingModeType.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newEPTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newEPTeachingModeType);
- newEPTeachingModeTypeInList.Add(newEPTeachingModeType);
- }
- }
- if (executablePlanView.TeachingPlaceIDList != null && executablePlanView.TeachingPlaceIDList.Count() > 0)
- {
- foreach (var newPlace in executablePlanView.TeachingPlaceIDList.ToList())
- {
- var newEPTeachingPlace = new EM_ExecutablePlanTeachingPlace();
- newEPTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
- newEPTeachingPlace.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newEPTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newEPTeachingPlace);
- newEPTeachingPlaceInList.Add(newEPTeachingPlace);
- }
- }
- //对应的教学任务信息更新(根据业务主键:学年学期ID、课程信息ID、班级信息ID、排课任务班ID或教学任务班ID)
- //注:由于相关业务主键冗余,目前不允许修改相关业务主键
- //暂不考虑对相关教学任务信息的处理
- }
- //事务提交
- //UnitOfWork.Commit();
- using (TransactionScope ts = new TransactionScope())
- {
- //删除
- UnitOfWork.Delete<EM_ExecutablePlanTeachingPlace>(x => executablePlanTPDelList.Contains(x.ExecutablePlanID));
- UnitOfWork.Delete<EM_ExecutablePlanTeachingModeType>(x => executablePlanTMDelList.Contains(x.ExecutablePlanID));
- //批量插入
- UnitOfWork.BulkInsert(newExecutablePlanInList);
- UnitOfWork.BulkInsert(newProfileInList);
- UnitOfWork.BulkInsert(newEPTeachingSettingInList);
- UnitOfWork.BulkInsert(newEPTeachingModeTypeInList);
- UnitOfWork.BulkInsert(newEPTeachingPlaceInList);
- //批量统一提交更新
- if (newExecutablePlanUpList != null && newExecutablePlanUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newExecutablePlanUpList);
- }
- //批量统一提交更新
- if (newProfileUpList != null && newProfileUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newProfileUpList);
- }
- //批量统一提交更新
- if (newEPTeachingSettingUpList != null && newEPTeachingSettingUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEPTeachingSettingUpList);
- }
- //批量插入
- UnitOfWork.BulkInsert(newEducationMissionInList);
- UnitOfWork.BulkInsert(newEducationMissionClassInList);
- UnitOfWork.BulkInsert(newEduTeachingSettingInList);
- UnitOfWork.BulkInsert(newEducationMissionClassInList, (x => x.CF_Classmajor));
- UnitOfWork.BulkInsert(newEducationSchedulingClassInList);
- UnitOfWork.BulkInsert(newEducationSchedulingClassInList, (x => x.CF_Student));
- UnitOfWork.BulkInsert(newEduSettingsInList);
- UnitOfWork.BulkInsert(newCourseProcessInList);
- //批量统一提交更新
- if (newEducationMissionUpList != null && newEducationMissionUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEducationMissionUpList);
- }
- //批量统一提交更新
- if (newEducationMissionClassUpList != null && newEducationMissionClassUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEducationMissionClassUpList);
- }
- //批量统一提交更新
- if (newEduTeachingSettingUpList != null && newEduTeachingSettingUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEduTeachingSettingUpList);
- }
- ts.Complete();
- }
- }
- else
- {
- throw new Exception("已存在相同的执行计划信息(学年学期、年级专业、课程信息唯一),请核查。");
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 根据专业计划信息批量新增
- /// 注:区分普教版本(年级专业)、成教版本(入学学年学期、专业信息)
- /// 注:此为成教版本(入学学年学期、专业信息)
- /// 注:此版本学生人数小于等于0时,不可生成对应的执行计划
- /// </summary>
- /// <param name="specialtyPlanViewList"></param>
- /// <param name="executablePlanView"></param>
- /// <returns></returns>
- public override string ExecutablePlanBatchAdd(List<SpecialtyPlanView> specialtyPlanViewList, ExecutablePlanView executablePlanView)
- {
- try
- {
- //查询专业计划对应的年级专业grademajorIDList
- var grademajorIDList = specialtyPlanViewList.Select(x => x.GrademajorID).Distinct().ToList();
- //查询对应的执行计划信息executablePlanList(暂时只匹配年级专业ID)
- var executablePlanList = ExecutablePlanDAL.ExecutablePlanRepository
- .GetList(x => grademajorIDList.Contains(x.GrademajorID), (x => x.EM_ExecutablePlanTeachingSetting)).ToList();
- int success = 0; //成功
- int fail = 0; //失败
- string tipMessage = null; //提示消息
- List<EM_ExecutablePlan> newExecutablePlanInList = new List<EM_ExecutablePlan>();
- List<EM_ExecutablePlanProfile> newProfileInList = new List<EM_ExecutablePlanProfile>();
- List<EM_ExecutablePlanTeachingSetting> newTeachingSettingInList = new List<EM_ExecutablePlanTeachingSetting>();
- List<EM_ExecutablePlanTeachingModeType> newTeachingModeTypeInList = new List<EM_ExecutablePlanTeachingModeType>();
- List<EM_ExecutablePlanTeachingPlace> newTeachingPlaceInList = new List<EM_ExecutablePlanTeachingPlace>();
- foreach (var specialtyPlanView in specialtyPlanViewList)
- {
- //判断对应的学年学期信息
- if (specialtyPlanView.Value < specialtyPlanView.StartValue)
- {
- //表示学年学期小于入学学年学期
- fail++;
- }
- else
- {
- if (specialtyPlanView.Value > specialtyPlanView.GraduatingSemesterValue)
- {
- //表示学年学期大于毕业学年学期
- fail++;
- }
- else
- {
- //判断对应的学生人数
- if (specialtyPlanView.StudentCount <= 0)
- {
- //表示学生人数小于等于0
- fail++;
- }
- else
- {
- //查询对应的执行计划信息(根据业务主键:学年学期ID、年级专业ID、课程信息ID)
- var executablePlan = executablePlanList.Where(x => x.SchoolyearID == specialtyPlanView.SchoolyearID
- && x.GrademajorID == specialtyPlanView.GrademajorID
- && x.CoursematerialID == specialtyPlanView.CoursematerialID).SingleOrDefault();
- if (executablePlan == null)
- {
- //表示新增
- var newExecutablePlan = new EM_ExecutablePlan();
- newExecutablePlan.ExecutablePlanID = Guid.NewGuid();
- //来源专业计划默认为必修课
- newExecutablePlan.SourceTypeID = (int)EM_SourceType.RequiredCourse;
- newExecutablePlan.DefaultClassName = specialtyPlanView.CourseName + "-" + specialtyPlanView.GrademajorName;
- newExecutablePlan.SpecialtyPlanID = specialtyPlanView.SpecialtyPlanID;
- newExecutablePlan.SchoolyearID = specialtyPlanView.SchoolyearID;
- newExecutablePlan.GrademajorID = specialtyPlanView.GrademajorID;
- newExecutablePlan.CoursematerialID = specialtyPlanView.CoursematerialID;
- newExecutablePlan.CourseStructureID = specialtyPlanView.CourseStructureID;
- newExecutablePlan.CourseCategoryID = specialtyPlanView.CourseCategoryID;
- newExecutablePlan.CourseTypeID = specialtyPlanView.CourseTypeID;
- newExecutablePlan.CourseQualityID = specialtyPlanView.CourseQualityID;
- newExecutablePlan.DepartmentID = specialtyPlanView.DepartmentID;
- newExecutablePlan.IsNeedMaterial = specialtyPlanView.IsNeedMaterial;
- newExecutablePlan.ResultTypeID = specialtyPlanView.ResultTypeID;
- newExecutablePlan.HandleModeID = specialtyPlanView.HandleModeID;
- newExecutablePlan.Remark = specialtyPlanView.Remark;
- SetNewStatus(newExecutablePlan, (int)EM_ExecuteStatus.NotSubmited);
- newExecutablePlanInList.Add(newExecutablePlan);
- var newProfile = new EM_ExecutablePlanProfile();
- newProfile.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newProfile.IsSpecialtycore = specialtyPlanView.IsSpecialtycore;
- newProfile.IsCooperation = specialtyPlanView.IsCooperation;
- newProfile.IsRequired = specialtyPlanView.IsRequired;
- newProfile.IsElective = specialtyPlanView.IsElective;
- newProfile.IsNetworkCourse = specialtyPlanView.IsNetworkCourse;
- newProfile.IsMainCourse = specialtyPlanView.IsMainCourse;
- newProfile.CourseFineID = specialtyPlanView.CourseFineID;
- newProfile.PracticeTypeID = specialtyPlanView.PracticeTypeID;
- newProfile.TeachinglanguageID = specialtyPlanView.TeachinglanguageID;
- newProfile.ExaminationModeID = specialtyPlanView.ExaminationModeID;
- SetNewStatus(newProfile);
- newProfileInList.Add(newProfile);
- var newTeachingSetting = new EM_ExecutablePlanTeachingSetting();
- newTeachingSetting.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newTeachingSetting.Credit = specialtyPlanView.Credit;
- newTeachingSetting.TheoryCourse = specialtyPlanView.TheoryCourse;
- newTeachingSetting.Practicehours = specialtyPlanView.Practicehours;
- newTeachingSetting.Trialhours = specialtyPlanView.Trialhours;
- newTeachingSetting.TheoryWeeklyNum = specialtyPlanView.TheoryWeeklyNum;
- newTeachingSetting.PracticeWeeklyNum = specialtyPlanView.PracticeWeeklyNum;
- newTeachingSetting.TrialWeeklyNum = specialtyPlanView.TrialWeeklyNum;
- newTeachingSetting.WeeklyHours = specialtyPlanView.WeeklyHours;
- newTeachingSetting.WeeklyNum = specialtyPlanView.WeeklyNum;
- newTeachingSetting.StartWeeklyNum = specialtyPlanView.StartWeeklyNum;
- newTeachingSetting.EndWeeklyNum = specialtyPlanView.EndWeeklyNum;
- newTeachingSettingInList.Add(newTeachingSetting);
- if (specialtyPlanView.TeachingModeIDList != null && specialtyPlanView.TeachingModeIDList.Count() > 0)
- {
- foreach (var newModeType in specialtyPlanView.TeachingModeIDList.ToList())
- {
- var newTeachingModeType = new EM_ExecutablePlanTeachingModeType();
- newTeachingModeType.ExecutablePlanTeachingModeTypeID = Guid.NewGuid();
- newTeachingModeType.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newTeachingModeType.TeachingModeID = newModeType;
- this.SetNewStatus(newTeachingModeType);
- newTeachingModeTypeInList.Add(newTeachingModeType);
- }
- }
- if (specialtyPlanView.TeachingPlaceIDList != null && specialtyPlanView.TeachingPlaceIDList.Count() > 0)
- {
- foreach (var newPlace in specialtyPlanView.TeachingPlaceIDList.ToList())
- {
- var newTeachingPlace = new EM_ExecutablePlanTeachingPlace();
- newTeachingPlace.ExecutablePlanTeachingPlaceID = Guid.NewGuid();
- newTeachingPlace.ExecutablePlanID = newExecutablePlan.ExecutablePlanID;
- newTeachingPlace.TeachingPlace = newPlace;
- this.SetNewStatus(newTeachingPlace);
- newTeachingPlaceInList.Add(newTeachingPlace);
- }
- }
- success++;
- }
- else
- {
- //表示已存在相同的执行计划信息
- fail++;
- }
- }
- }
- }
- }
- //事务提交
- using (TransactionScope ts = new TransactionScope())
- {
- //批量插入
- UnitOfWork.BulkInsert(newExecutablePlanInList);
- UnitOfWork.BulkInsert(newProfileInList);
- UnitOfWork.BulkInsert(newTeachingSettingInList);
- UnitOfWork.BulkInsert(newTeachingModeTypeInList);
- UnitOfWork.BulkInsert(newTeachingPlaceInList);
- ts.Complete();
- }
- if (success > 0 && fail <= 0)
- {
- tipMessage = success + "条";
- }
- else
- {
- tipMessage = success + "条,失败" + fail + "条,原因:学生人数等于0、学年学期小于入学学年学期、学年学期大于毕业学年学期或已存在相同的执行计划信息,请检查";
- }
- return tipMessage;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询对应的未新增专业计划信息SpecialtyPlanView
- /// 注:区分普教版本(年级专业)、成教版本(入学学年学期、专业信息)
- /// 注:此为成教版本(入学学年学期、专业信息)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="grademajorID"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="teachingModeID"></param>
- /// <param name="handleModeID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public override IGridResultSet<SpecialtyPlanView> GetSpecialtyPlanViewNoAddGrid(ConfiguretView configuretView, Guid? schoolyearID,
- Guid? campusID, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
- Guid? grademajorID, Guid? coursematerialID, int? teachingModeID, int? handleModeID, int pageIndex, int pageSize)
- {
- //年级专业
- Expression<Func<CF_Grademajor, bool>> expGrademajor = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (yearID.HasValue)
- {
- expGrademajor = expGrademajor.And(x => x.GradeID == yearID);
- }
- if (grademajorID.HasValue)
- {
- expGrademajor = expGrademajor.And(x => x.GrademajorID == grademajorID);
- }
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.SchoolyearID == schoolyearID);
- }
- if (coursematerialID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
- }
- if (handleModeID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.HandleModeID == handleModeID);
- }
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.SchoolyearID == schoolyearID);
- }
- if (grademajorID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.GrademajorID == grademajorID);
- }
- if (coursematerialID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.CoursematerialID == coursematerialID);
- }
- var query = ExecutablePlanDAL.GetAdultSpecialtyPlanViewNoAddQueryable(expGrademajor, expSpecialtyPlan, expStudent, expExecutablePlan);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (standardID.HasValue)
- {
- query = query.Where(x => x.StandardID == standardID);
- }
- if (educationID.HasValue)
- {
- query = query.Where(x => x.EducationID == educationID);
- }
- if (learningformID.HasValue)
- {
- query = query.Where(x => x.LearningformID == learningformID);
- }
- if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(learnSystem);
- query = query.Where(x => x.LearnSystem == LearnSystems);
- }
- if (teachingModeID.HasValue)
- {
- //授课方式
- query = query.Where(x => x.TeachingModeIDList.Contains(teachingModeID));
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query)
- .OrderBy(x => x.GrademajorCode.Length).ThenBy(x => x.GrademajorCode)
- .ThenBy(x => x.Value).ThenBy(x => x.CourseTypeID)
- .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode)
- .ToGridResultSet<SpecialtyPlanView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询对应的未新增专业计划信息List
- /// 注:区分普教版本(年级专业)、成教版本(入学学年学期、专业信息)
- /// 注:此为成教版本(入学学年学期、专业信息)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="grademajorID"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="teachingModeID"></param>
- /// <param name="handleModeID"></param>
- /// <returns></returns>
- public override IList<SpecialtyPlanView> GetSpecialtyPlanViewNoAddList(ConfiguretView configuretView, Guid? schoolyearID,
- Guid? campusID, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
- Guid? grademajorID, Guid? coursematerialID, int? teachingModeID, int? handleModeID)
- {
- //年级专业
- Expression<Func<CF_Grademajor, bool>> expGrademajor = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (yearID.HasValue)
- {
- expGrademajor = expGrademajor.And(x => x.GradeID == yearID);
- }
- if (grademajorID.HasValue)
- {
- expGrademajor = expGrademajor.And(x => x.GrademajorID == grademajorID);
- }
- //专业计划
- Expression<Func<EM_SpecialtyPlan, bool>> expSpecialtyPlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.SchoolyearID == schoolyearID);
- }
- if (coursematerialID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.CoursematerialID == coursematerialID);
- }
- if (handleModeID.HasValue)
- {
- expSpecialtyPlan = expSpecialtyPlan.And(x => x.HandleModeID == handleModeID);
- }
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //执行计划
- Expression<Func<EM_ExecutablePlan, bool>> expExecutablePlan = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.SchoolyearID == schoolyearID);
- }
- if (grademajorID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.GrademajorID == grademajorID);
- }
- if (coursematerialID.HasValue)
- {
- expExecutablePlan = expExecutablePlan.And(x => x.CoursematerialID == coursematerialID);
- }
- var query = ExecutablePlanDAL.GetAdultSpecialtyPlanViewNoAddQueryable(expGrademajor, expSpecialtyPlan, expStudent, expExecutablePlan);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (standardID.HasValue)
- {
- query = query.Where(x => x.StandardID == standardID);
- }
- if (educationID.HasValue)
- {
- query = query.Where(x => x.EducationID == educationID);
- }
- if (learningformID.HasValue)
- {
- query = query.Where(x => x.LearningformID == learningformID);
- }
- if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(learnSystem);
- query = query.Where(x => x.LearnSystem == LearnSystems);
- }
- if (teachingModeID.HasValue)
- {
- //授课方式
- query = query.Where(x => x.TeachingModeIDList.Contains(teachingModeID));
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query)
- .OrderBy(x => x.GrademajorCode.Length).ThenBy(x => x.GrademajorCode)
- .ThenBy(x => x.Value).ThenBy(x => x.CourseTypeID)
- .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode).ToList();
- }
- /// <summary>
- /// 执行计划提交
- /// 注:刷新相关的教学任务信息
- /// 注:区分普教版本(年级专业)、成教版本(入学学年学期、专业信息)
- /// 注:此为成教版本(入学学年学期、专业信息)
- /// 注:此版本学生人数小于等于0时,不可提交,但由于有异动的情况,需进一步优化逻辑(对教学任务班学生名单进行判断)
- /// </summary>
- /// <param name="executablePlanIDList"></param>
- /// <returns></returns>
- public override string ExecutablePlanSubmit(List<Guid?> executablePlanIDList)
- {
- try
- {
- //教学任务班生成规则如下:
- //1、对应的授课方式为必选项且可多选;
- //2、课程信息对应的上课类型为空时,默认只生成一种类型的教学任务班(授课方式为最小Value授课方式);
- //3、以上课类型为标准,匹配对应的授课方式来生成教学任务班;
- //4、根据授课方式与上课类型查询是否分班情况,存在分班情况,则生成对应的教学任务班;
- //5、对应的授课方式存在分班情况时,默认生成成绩合并录入形式的教学任务班(同一条教学任务);
- //6、年级专业对应的计划范围不于等于0时,不生成对应的教学任务班(无法生成);
- //7、年级专业对应的学生人数小于等于0时,不生成对应的教学任务班(成教版本有此逻辑);
- //8、如对应的年级专业有多个班级,都生成对应的教学任务班(只取在校状态为在校的学生信息);
- //查询对应的执行计划信息executablePlanViewList
- var executablePlanViewList = ExecutablePlanDAL.GetExecutablePlanViewQueryable(x => executablePlanIDList.Contains(x.ExecutablePlanID)).ToList();
- //查询对应的年级专业IDList
- var grademajorIDList = executablePlanViewList.Select(x => x.GrademajorID).Distinct().ToList();
- //查询对应的班级范围信息classmajorList
- var classmajorList = ExecutablePlanDAL.GetClassmajorRangeQueryable(x => grademajorIDList.Contains(x.GrademajorID)).ToList();
- //查询对应的学生范围信息studentList
- var studentList = ExecutablePlanDAL.GetStudentRangeQueryable(x => grademajorIDList.Contains(x.GrademajorID)).ToList();
- //查询对应在校状态IDList
- var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
- //查询对应的教学任务班信息(业务主键:学年学期ID、课程信息ID、班级信息ID、教学任务班ID或排课任务班ID)
- var educationMissionClassList = ExecutablePlanDAL.GetEducationMissionClassQueryable(x => executablePlanIDList.Contains(x.ExecutablePlanID)).ToList();
- //查询授课方式teachingModeList
- var teachingModeList = DictionaryHelper.GetDictionaryValue(EMIS.ViewModel.DictionaryItem.CF_TeachingMode).ToList();
- int success = 0; //成功
- int fail = 0; //失败
- bool isEpPass = true; //提交成功判断标识
- string tipMessage = null; //提示消息
- List<EM_EducationMission> newEducationMissionInList = new List<EM_EducationMission>();
- List<EM_EducationMission> newEducationMissionUpList = new List<EM_EducationMission>();
- List<EM_EducationMissionClass> newEducationMissionClassInList = new List<EM_EducationMissionClass>();
- List<EM_EducationMissionClass> newEducationMissionClassUpList = new List<EM_EducationMissionClass>();
- List<EM_EducationMissionClassTeachingSetting> newEduTeachingSettingInList = new List<EM_EducationMissionClassTeachingSetting>();
- List<EM_EducationMissionClassTeachingSetting> newEduTeachingSettingUpList = new List<EM_EducationMissionClassTeachingSetting>();
- List<EM_EducationSchedulingClass> newEducationSchedulingClassInList = new List<EM_EducationSchedulingClass>();
- List<EM_EducationMissionClassSettings> newEduSettingsInList = new List<EM_EducationMissionClassSettings>();
- List<EM_CourseProcess> newCourseProcessInList = new List<EM_CourseProcess>();
- List<Guid?> executablePlanIDUpList = new List<Guid?>();
- foreach (var executablePlanView in executablePlanViewList)
- {
- //执行计划对应的授课方式判断
- if (executablePlanView.TeachingModeIDList != null && executablePlanView.TeachingModeIDList.Count() > 0)
- {
- //查询对应的班级范围信息epClassmajorList
- var epClassmajorList = classmajorList.Where(x => x.GrademajorID == executablePlanView.GrademajorID).ToList();
- //执行计划对应的计划范围判断
- if (epClassmajorList != null && epClassmajorList.Count() > 0)
- {
- //查询对应的班级信息epClassmajorIDList
- var epClassmajorIDList = epClassmajorList.Select(x => x.ClassmajorID).ToList();
- //查询对应的学生范围信息studentList
- var epStudentList = studentList.Where(x => epClassmajorIDList.Contains(x.ClassmajorID.Value)).ToList();
- //执行计划对应的学生范围判断
- if (epStudentList != null && epStudentList.Count() > 0)
- {
- //查询对应的课程信息中授课方式分班信息List
- var separateModeTypeList = ExecutablePlanDAL.GetSeparateModeTypeQueryble(x => x.CoursematerialID == executablePlanView.CoursematerialID).ToList();
- //查询执行计划中授课方式及对应的上课类型中的授课方式(匹配上课类型)
- var minTeachingModeID = executablePlanView.TeachingModeIDList
- .Where(x => !separateModeTypeList.Contains(x)).OrderBy(x => x).FirstOrDefault();
- List<int?> teachingModeIDList = new List<int?>();
- if (minTeachingModeID != null)
- {
- teachingModeIDList.Add(minTeachingModeID);
- teachingModeIDList = teachingModeIDList.Concat(executablePlanView.TeachingModeIDList
- .Where(x => separateModeTypeList.Contains(x))).GroupBy(x => x).Select(x => x.Key).ToList();
- }
- else
- {
- teachingModeIDList = executablePlanView.TeachingModeIDList
- .Where(x => separateModeTypeList.Contains(x)).GroupBy(x => x).Select(x => x.Key).ToList();
- }
- //查询对应的授课方式信息List(匹配上课类型)
- var epTeachingModeList = teachingModeList.Where(x => teachingModeIDList.Contains(x.Value)).ToList();
- //查询对应的教学任务信息(业务主键:学年学期ID、课程信息ID、班级信息ID、排课任务班ID或教学任务班ID)
- var epEducationMissionClassList = educationMissionClassList
- .Where(x => x.EM_EducationMission.SchoolyearID == executablePlanView.SchoolyearID
- && x.CoursematerialID == executablePlanView.CoursematerialID
- && x.CF_Classmajor.Any(w => epClassmajorIDList.Contains(w.ClassmajorID))).ToList();
- foreach (var classmajor in epClassmajorList)
- {
- //查询班级信息对应的教学任务班信息List
- var educlList = epEducationMissionClassList.Where(x => x.CF_Classmajor
- .Any(w => w.ClassmajorID == classmajor.ClassmajorID)).ToList();
- if (educlList != null && educlList.Count() > 0)
- {
- //表示存在对应的教学任务班
- //根据教学任务ID对educlList进行分组
- var edugrList = educlList.GroupBy(x => x.EducationMissionID).ToList();
- //根据授课方式对educlList进行分组
- var tmgrList = educlList.GroupBy(x => x.TeachingModeID).ToList();
- if (edugrList.Count() > 1 && tmgrList.Count() > 1)
- {
- //表示对应的教学任务班存在分班且成绩分开录入、授课方式多种情况
- //目前此种数据有误,在生成期末设定时有问题(这里暂不处理)
- isEpPass = false;
- //终止此循环,提交下一个执行计划信息
- break;
- }
- else if (edugrList.Count() > 1 && epTeachingModeList.Count() > 1)
- {
- //表示对应的教学任务班存在分班且成绩分开录入、授课方式只有一种情况,不可再生成多种授课方式的教学任务班信息
- //目前此种数据有误,在生成期末设定时有问题
- isEpPass = false;
- //终止此循环,提交下一个执行计划信息
- break;
- }
- else if (tmgrList.Count() == 1 && epTeachingModeList.Count() == 1)
- {
- //表示对应的教学任务班只存在一种授课方式信息(含分班且成绩合并或分开录入)
- //同时生成的教学任务班信息授课方式只有一种的情况(直接修改)
- foreach (var educl in educlList)
- {
- if (!newEducationMissionUpList.Any(x => x.EducationMissionID == educl.EducationMissionID))
- {
- educl.EM_EducationMission.ClassName = executablePlanView.CourseName + "-" + classmajor.Name;
- educl.EM_EducationMission.SchoolyearID = executablePlanView.SchoolyearID;
- educl.EM_EducationMission.CollegeID = executablePlanView.CollegeID;
- educl.EM_EducationMission.DepartmentID = executablePlanView.DepartmentID;
- SetModifyStatus(educl.EM_EducationMission);
- newEducationMissionUpList.Add(educl.EM_EducationMission);
- }
- if (!newEducationMissionClassUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- educl.CoursematerialID = executablePlanView.CoursematerialID;
- educl.CourseStructureID = executablePlanView.CourseStructureID;
- educl.CourseCategoryID = executablePlanView.CourseCategoryID;
- educl.CourseTypeID = executablePlanView.CourseTypeID;
- educl.CourseQualityID = executablePlanView.CourseQualityID;
- educl.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- educl.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- educl.ExaminationModeID = executablePlanView.ExaminationModeID;
- educl.ResultTypeID = executablePlanView.ResultTypeID;
- educl.HandleModeID = executablePlanView.HandleModeID;
- educl.TeachingModeID = epTeachingModeList[0].Value;
- SetModifyStatus(educl);
- newEducationMissionClassUpList.Add(educl);
- }
- if (!newEduTeachingSettingUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.EM_EducationMissionClassTeachingSetting.Credit = executablePlanView.Credit;
- educl.EM_EducationMissionClassTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- educl.EM_EducationMissionClassTeachingSetting.Practicehours = executablePlanView.Practicehours;
- educl.EM_EducationMissionClassTeachingSetting.Trialhours = executablePlanView.Trialhours;
- //if (educl.RecordStatus != (int)EM_EducationMissionClassStatus.Submitted || educl.RecordStatus != (int)EM_EducationMissionClassStatus.Scheduled)
- //{
- // //暂不考虑
- // educl.EM_EducationMissionClassTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- //}
- newEduTeachingSettingUpList.Add(educl.EM_EducationMissionClassTeachingSetting);
- }
- }
- }
- else
- {
- //表示无论分班与否,成绩都是合并录入的情况(同一个教学任务ID)
- //表示可根据执行计划中匹配上课类型后的授课方式进行增加、修改对应的教学任务班信息
- foreach (var educl in educlList)
- {
- //修改
- if (!newEducationMissionUpList.Any(x => x.EducationMissionID == educl.EducationMissionID))
- {
- educl.EM_EducationMission.ClassName = executablePlanView.CourseName + "-" + classmajor.Name;
- educl.EM_EducationMission.SchoolyearID = executablePlanView.SchoolyearID;
- educl.EM_EducationMission.CollegeID = executablePlanView.CollegeID;
- educl.EM_EducationMission.DepartmentID = executablePlanView.DepartmentID;
- SetModifyStatus(educl.EM_EducationMission);
- newEducationMissionUpList.Add(educl.EM_EducationMission);
- }
- if (!newEducationMissionClassUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- educl.CoursematerialID = executablePlanView.CoursematerialID;
- educl.CourseStructureID = executablePlanView.CourseStructureID;
- educl.CourseCategoryID = executablePlanView.CourseCategoryID;
- educl.CourseTypeID = executablePlanView.CourseTypeID;
- educl.CourseQualityID = executablePlanView.CourseQualityID;
- educl.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- educl.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- educl.ExaminationModeID = executablePlanView.ExaminationModeID;
- educl.ResultTypeID = executablePlanView.ResultTypeID;
- educl.HandleModeID = executablePlanView.HandleModeID;
- SetModifyStatus(educl);
- newEducationMissionClassUpList.Add(educl);
- }
- if (!newEduTeachingSettingUpList.Any(x => x.EducationMissionClassID == educl.EducationMissionClassID))
- {
- educl.EM_EducationMissionClassTeachingSetting.Credit = executablePlanView.Credit;
- educl.EM_EducationMissionClassTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- educl.EM_EducationMissionClassTeachingSetting.Practicehours = executablePlanView.Practicehours;
- educl.EM_EducationMissionClassTeachingSetting.Trialhours = executablePlanView.Trialhours;
- //if (educl.RecordStatus != (int)EM_EducationMissionClassStatus.Submitted || educl.RecordStatus != (int)EM_EducationMissionClassStatus.Scheduled)
- //{
- // //暂不考虑
- // educl.EM_EducationMissionClassTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- // educl.EM_EducationMissionClassTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- // educl.EM_EducationMissionClassTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- //}
- newEduTeachingSettingUpList.Add(educl.EM_EducationMissionClassTeachingSetting);
- }
- }
- //将执行计划中匹配上课类型后的授课方式与对应的教学任务班的授课方式进行对比
- var educltmList = tmgrList.Select(x => x.Key).ToList();
- var newTeachingModeList = epTeachingModeList.Where(x => !educltmList.Contains(x.Value)).ToList();
- foreach (var newTeachingMode in newTeachingModeList)
- {
- //新增
- var newEducationMissionClass = new EM_EducationMissionClass();
- newEducationMissionClass.EducationMissionClassID = Guid.NewGuid();
- newEducationMissionClass.EducationMissionID = edugrList[0].Key;
- newEducationMissionClass.MainScheduleClassID = classmajor.ClassmajorID;
- newEducationMissionClass.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- newEducationMissionClass.OrderNo = classmajor.ClassNum ?? 1;
- newEducationMissionClass.Name = executablePlanView.CourseName + "-" + classmajor.Name + "-(" + newTeachingMode.Name + ")";
- newEducationMissionClass.CoursematerialID = executablePlanView.CoursematerialID;
- newEducationMissionClass.CourseStructureID = executablePlanView.CourseStructureID;
- newEducationMissionClass.CourseCategoryID = executablePlanView.CourseCategoryID;
- newEducationMissionClass.CourseTypeID = executablePlanView.CourseTypeID;
- newEducationMissionClass.CourseQualityID = executablePlanView.CourseQualityID;
- newEducationMissionClass.ClassroomTypeID = null;
- newEducationMissionClass.ClassroomID = null;
- newEducationMissionClass.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- newEducationMissionClass.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- newEducationMissionClass.ExaminationModeID = executablePlanView.ExaminationModeID;
- newEducationMissionClass.ResultTypeID = executablePlanView.ResultTypeID;
- newEducationMissionClass.HandleModeID = executablePlanView.HandleModeID;
- newEducationMissionClass.TeachingModeID = newTeachingMode.Value;
- newEducationMissionClass.Remark = executablePlanView.CourseName + "-" + classmajor.Name + "-(" + newTeachingMode.Name + ")";
- SetNewStatus(newEducationMissionClass, (int)EM_EducationMissionClassStatus.NotSubmitted);
- newEducationMissionClassInList.Add(newEducationMissionClass);
- var newEduTeachingSetting = new EM_EducationMissionClassTeachingSetting();
- newEduTeachingSetting.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduTeachingSetting.Credit = executablePlanView.Credit;
- newEduTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- newEduTeachingSetting.Practicehours = executablePlanView.Practicehours;
- newEduTeachingSetting.Trialhours = executablePlanView.Trialhours;
- newEduTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- newEduTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- newEduTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- newEduTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- newEduTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- newEduTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- newEduTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEduTeachingSettingInList.Add(newEduTeachingSetting);
- newEducationMissionClass.CF_Classmajor = new HashSet<CF_Classmajor>();
- newEducationMissionClass.CF_Classmajor.Add(classmajor);
- var newEducationSchedulingClass = new EM_EducationSchedulingClass();
- newEducationSchedulingClass.EducationSchedulingClassID = Guid.NewGuid();
- newEducationSchedulingClass.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationSchedulingClass.TaskGroupName = "1组";
- newEducationSchedulingClass.Remark = classmajor.Name;
- SetNewStatus(newEducationSchedulingClass);
- newEducationSchedulingClassInList.Add(newEducationSchedulingClass);
- newEducationSchedulingClass.CF_Student = new HashSet<CF_Student>();
- var newStudent = studentList.Where(x => x.ClassmajorID == classmajor.ClassmajorID
- && inschoolStatusList.Contains(x.InSchoolStatusID)).ToList();
- newStudent.ForEach(x => newEducationSchedulingClass.CF_Student.Add(x));
- for (int i = 0; i < executablePlanView.EndWeeklyNum; i++)
- {
- var newEduSettings = new EM_EducationMissionClassSettings();
- newEduSettings.EducationMissionClassSettingsID = Guid.NewGuid();
- newEduSettings.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduSettings.WeeklyNum = i + 1;
- SetNewStatus(newEduSettings);
- newEduSettingsInList.Add(newEduSettings);
- var newCourseProcess = new EM_CourseProcess();
- newCourseProcess.CourseProcessID = Guid.NewGuid();
- newCourseProcess.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newCourseProcess.Week = i + 1;
- newCourseProcess.Times = executablePlanView.WeeklyHours;
- newCourseProcessInList.Add(newCourseProcess);
- }
- }
- }
- }
- else
- {
- //表示不存在对应的教学任务班(新增)
- var newEducationMission = new EM_EducationMission();
- newEducationMission.EducationMissionID = Guid.NewGuid();
- newEducationMission.ClassName = executablePlanView.CourseName + "-" + classmajor.Name;
- newEducationMission.SchoolyearID = executablePlanView.SchoolyearID;
- newEducationMission.CollegeID = executablePlanView.CollegeID;
- newEducationMission.DepartmentID = executablePlanView.DepartmentID;
- SetNewStatus(newEducationMission);
- newEducationMissionInList.Add(newEducationMission);
- foreach (var epTeachingMode in epTeachingModeList)
- {
- var newEducationMissionClass = new EM_EducationMissionClass();
- newEducationMissionClass.EducationMissionClassID = Guid.NewGuid();
- newEducationMissionClass.EducationMissionID = newEducationMission.EducationMissionID;
- newEducationMissionClass.MainScheduleClassID = classmajor.ClassmajorID;
- newEducationMissionClass.OptionalCourseTypeID = executablePlanView.SourceTypeID;
- newEducationMissionClass.OrderNo = classmajor.ClassNum ?? 1;
- newEducationMissionClass.Name = executablePlanView.CourseName + "-" + classmajor.Name + "-(" + epTeachingMode.Name + ")";
- newEducationMissionClass.CoursematerialID = executablePlanView.CoursematerialID;
- newEducationMissionClass.CourseStructureID = executablePlanView.CourseStructureID;
- newEducationMissionClass.CourseCategoryID = executablePlanView.CourseCategoryID;
- newEducationMissionClass.CourseTypeID = executablePlanView.CourseTypeID;
- newEducationMissionClass.CourseQualityID = executablePlanView.CourseQualityID;
- newEducationMissionClass.ClassroomTypeID = null;
- newEducationMissionClass.ClassroomID = null;
- newEducationMissionClass.IsNeedMaterial = executablePlanView.IsNeedMaterial;
- newEducationMissionClass.TeachinglanguageID = executablePlanView.TeachinglanguageID;
- newEducationMissionClass.ExaminationModeID = executablePlanView.ExaminationModeID;
- newEducationMissionClass.ResultTypeID = executablePlanView.ResultTypeID;
- newEducationMissionClass.HandleModeID = executablePlanView.HandleModeID;
- newEducationMissionClass.TeachingModeID = epTeachingMode.Value;
- newEducationMissionClass.Remark = executablePlanView.CourseName + "-" + classmajor.Name + "-(" + epTeachingMode.Name + ")";
- SetNewStatus(newEducationMissionClass, (int)EM_EducationMissionClassStatus.NotSubmitted);
- newEducationMissionClassInList.Add(newEducationMissionClass);
- var newEduTeachingSetting = new EM_EducationMissionClassTeachingSetting();
- newEduTeachingSetting.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduTeachingSetting.Credit = executablePlanView.Credit;
- newEduTeachingSetting.TheoryCourse = executablePlanView.TheoryCourse;
- newEduTeachingSetting.Practicehours = executablePlanView.Practicehours;
- newEduTeachingSetting.Trialhours = executablePlanView.Trialhours;
- newEduTeachingSetting.TheoryWeeklyNum = executablePlanView.TheoryWeeklyNum;
- newEduTeachingSetting.PracticeWeeklyNum = executablePlanView.PracticeWeeklyNum;
- newEduTeachingSetting.TrialWeeklyNum = executablePlanView.TrialWeeklyNum;
- newEduTeachingSetting.WeeklyHours = executablePlanView.WeeklyHours;
- newEduTeachingSetting.WeeklyNum = executablePlanView.WeeklyNum;
- newEduTeachingSetting.StartWeeklyNum = executablePlanView.StartWeeklyNum;
- newEduTeachingSetting.EndWeeklyNum = executablePlanView.EndWeeklyNum;
- newEduTeachingSettingInList.Add(newEduTeachingSetting);
- newEducationMissionClass.CF_Classmajor = new HashSet<CF_Classmajor>();
- newEducationMissionClass.CF_Classmajor.Add(classmajor);
- var newEducationSchedulingClass = new EM_EducationSchedulingClass();
- newEducationSchedulingClass.EducationSchedulingClassID = Guid.NewGuid();
- newEducationSchedulingClass.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEducationSchedulingClass.TaskGroupName = "1组";
- newEducationSchedulingClass.Remark = classmajor.Name;
- SetNewStatus(newEducationSchedulingClass);
- newEducationSchedulingClassInList.Add(newEducationSchedulingClass);
- newEducationSchedulingClass.CF_Student = new HashSet<CF_Student>();
- var newStudent = studentList.Where(x => x.ClassmajorID == classmajor.ClassmajorID
- && inschoolStatusList.Contains(x.InSchoolStatusID)).ToList();
- newStudent.ForEach(x => newEducationSchedulingClass.CF_Student.Add(x));
- for (int i = 0; i < executablePlanView.EndWeeklyNum; i++)
- {
- var newEduSettings = new EM_EducationMissionClassSettings();
- newEduSettings.EducationMissionClassSettingsID = Guid.NewGuid();
- newEduSettings.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newEduSettings.WeeklyNum = i + 1;
- SetNewStatus(newEduSettings);
- newEduSettingsInList.Add(newEduSettings);
- var newCourseProcess = new EM_CourseProcess();
- newCourseProcess.CourseProcessID = Guid.NewGuid();
- newCourseProcess.EducationMissionClassID = newEducationMissionClass.EducationMissionClassID;
- newCourseProcess.Week = i + 1;
- newCourseProcess.Times = executablePlanView.WeeklyHours;
- newCourseProcessInList.Add(newCourseProcess);
- }
- }
- }
- }
- }
- else
- {
- //表示执行计划对应的学生范围不存在(小于等于0)
- isEpPass = false;
- }
- }
- else
- {
- //表示执行计划对应的计划范围不存在(小于等于0)
- isEpPass = false;
- }
- }
- else
- {
- //表示执行计划对应的授课方式为空
- isEpPass = false;
- }
- if (isEpPass)
- {
- //表示提交成功
- executablePlanIDUpList.Add(executablePlanView.ExecutablePlanID);
- success++;
- }
- else
- {
- //表示提交失败
- fail++;
- isEpPass = true;
- }
- }
- //更新提交成功的执行计划的状态
- var newExecutablePlanUpList = ExecutablePlanDAL.ExecutablePlanRepository
- .GetList(x => executablePlanIDUpList.Contains(x.ExecutablePlanID)).ToList();
- newExecutablePlanUpList.ForEach(x =>
- {
- x.RecordStatus = (int)EM_ExecuteStatus.Submited;
- SetModifyStatus(x);
- });
- using (TransactionScope ts = new TransactionScope())
- {
- //批量插入
- UnitOfWork.BulkInsert(newEducationMissionInList);
- UnitOfWork.BulkInsert(newEducationMissionClassInList);
- UnitOfWork.BulkInsert(newEduTeachingSettingInList);
- UnitOfWork.BulkInsert(newEducationMissionClassInList, (x => x.CF_Classmajor));
- UnitOfWork.BulkInsert(newEducationSchedulingClassInList);
- UnitOfWork.BulkInsert(newEducationSchedulingClassInList, (x => x.CF_Student));
- UnitOfWork.BulkInsert(newEduSettingsInList);
- UnitOfWork.BulkInsert(newCourseProcessInList);
- //批量统一提交更新
- if (newEducationMissionUpList != null && newEducationMissionUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEducationMissionUpList);
- }
- //批量统一提交更新
- if (newEducationMissionClassUpList != null && newEducationMissionClassUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEducationMissionClassUpList);
- }
- //批量统一提交更新
- if (newEduTeachingSettingUpList != null && newEduTeachingSettingUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newEduTeachingSettingUpList);
- }
- //批量统一提交更新
- if (newExecutablePlanUpList != null && newExecutablePlanUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(newExecutablePlanUpList);
- }
- ts.Complete();
- }
- if (success > 0 && fail <= 0)
- {
- tipMessage = success + "条";
- }
- else
- {
- //暂时不提示此消息(存在分班且成绩分开录入同时授课方式多种或存在分班且成绩分开录入同时生成多种授课方式的教学任务班信息(请删除后,再提交))
- tipMessage = success + "条,失败" + fail + "条,原因:数据有误,请检查(授课方式为空、执行计划范围为0或学生人数为0)";
- }
- return tipMessage;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- }
- }
|