培训计划 每年限制一次去除

This commit is contained in:
wyw 2026-04-08 09:21:40 +08:00
parent cd3196ba55
commit 81e7935040

View File

@ -61,20 +61,20 @@ namespace APT.SC.WebApi.Controllers.Api.SE
var ListPlanDetail = entity.Nav_ListPlanDetail;
entity.Nav_ListPlanDetail = null;
List<T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT> ListDetailDepartment = new List<T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT>();
Expression<Func<T_SE_TRAIN_PLAN, bool>> expression = e => e.ID != entity.ID && e.YEAR == entity.YEAR && !e.IS_DELETED;
if (entity.TYPE == MS.Domain.Enums.PlanType.Company)
{
expression = expression.And(e => e.TYPE == entity.TYPE);
}
else
{
expression = expression.And(e => e.DEPARTMENT_ID == APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID);
}
var check = GetEntity(expression);
if (check != null)
{
throw new Exception("您所在层级/组织当年度已经制定过培训计划,请勿多次提交!");
}
//Expression<Func<T_SE_TRAIN_PLAN, bool>> expression = e => e.ID != entity.ID && e.YEAR == entity.YEAR && !e.IS_DELETED;
//if (entity.TYPE == MS.Domain.Enums.PlanType.Company)
//{
// expression = expression.And(e => e.TYPE == entity.TYPE);
//}
//else
//{
// expression = expression.And(e => e.DEPARTMENT_ID == APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID);
//}
//var check = GetEntity(expression);
//if (check != null)
//{
// throw new Exception("您所在层级/组织当年度已经制定过培训计划,请勿多次提交!");
//}
if (ListPlanDetail != null && ListPlanDetail.Count() > 0)
{
foreach (var item in ListPlanDetail)