跑批 触发培训计划
This commit is contained in:
parent
267c35191f
commit
bf639aa40c
@ -85,7 +85,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
CheckCreateTrainSurvey(filter, dtNow, config);
|
||||
|
||||
//部门培训计划
|
||||
CheckDepTrainPlan(filter, dtNow, config);
|
||||
//CheckDepTrainPlan(filter, dtNow, config);
|
||||
CreateYearTrainPlan(filter, dtNow, config);
|
||||
//到时间触发年度培训计划,搜集完成的部门培训计划
|
||||
FinishYearTrainPlan(filter, dtNow, config);
|
||||
//培训通知
|
||||
@ -1308,12 +1309,12 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
return true;
|
||||
});
|
||||
}
|
||||
private JsonActionResult<bool> CreateYearTrainPlan([FromBody] KeywordFilter filter)
|
||||
private JsonActionResult<bool> CreateYearTrainPlan(KeywordFilter filter, DateTime dtNow, T_SE_SECONFIG config)
|
||||
{
|
||||
return SafeExecute<bool>(() =>
|
||||
{
|
||||
var config = GetEntity<T_SE_SECONFIG>(t => true);
|
||||
var dt = DateTime.Now;
|
||||
//var config = GetEntity<T_SE_SECONFIG>(t => true);
|
||||
//var dt = DateTime.Now;
|
||||
var mm = 12;
|
||||
var dd = 1;
|
||||
if (config != null && config.DEP_TRAIN_PLAN_START_TIME != null)
|
||||
@ -1321,10 +1322,14 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
mm = config.DEP_TRAIN_PLAN_START_TIME.Value.Month;
|
||||
dd = config.DEP_TRAIN_PLAN_START_TIME.Value.Day;
|
||||
}
|
||||
if (mm == dt.Month && dd == dt.Day)
|
||||
if (mm == dtNow.Month && dd == dtNow.Day)
|
||||
{
|
||||
int year = int.Parse(dt.Year.ToString());
|
||||
var yearPlan = this.GetEntity<T_SE_YEAR_TRAIN_PLAN>(e => e.PLAN_YEAR == year || e.PLAN_YEAR == year + 1);
|
||||
int year = int.Parse(dtNow.Year.ToString());
|
||||
if (mm > 9)
|
||||
{
|
||||
year++;//超过9月算 制定 明年的代办
|
||||
}
|
||||
var yearPlan = this.GetEntity<T_SE_TRAIN_PLAN>(e => e.YEAR == year);
|
||||
if (yearPlan != null)
|
||||
{
|
||||
return true;
|
||||
@ -1333,20 +1338,44 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
if (approveRole != null)
|
||||
{
|
||||
var user = GetEntity<T_FM_USER>(e => e.APPROVE_ROLE_ID.HasValue && e.APPROVE_ROLE_ID.Value == approveRole.ID && e.ENABLE_STATUS == 0);
|
||||
if (user == null)
|
||||
{
|
||||
approveRole = this.GetEntity<T_PF_APPROVAL_ROLE>(e => e.NAME.Contains("总监") && e.NAME.Contains("安"));
|
||||
if (approveRole != null)
|
||||
{
|
||||
user = GetEntity<T_FM_USER>(e => e.APPROVE_ROLE_ID.HasValue && e.APPROVE_ROLE_ID.Value == approveRole.ID && e.ENABLE_STATUS == 0);
|
||||
}
|
||||
}
|
||||
if (user != null)
|
||||
{
|
||||
T_SE_YEAR_TRAIN_PLAN yearTrainPlan = new T_SE_YEAR_TRAIN_PLAN
|
||||
//T_SE_YEAR_TRAIN_PLAN yearTrainPlan = new T_SE_YEAR_TRAIN_PLAN
|
||||
//{
|
||||
// ID = Guid.NewGuid(),
|
||||
// PLAN_YEAR = year,
|
||||
// LAUNCH_TIME = dtNow,
|
||||
// LAUNCH_DEPARTMENT_ID = user.DEPARTMENT_ID,
|
||||
// LAUNCH_USER_ID = user.ID,
|
||||
// STATUS = PFStandardStatus.Draft,
|
||||
// ORG_ID = filter.GetOrgId(),
|
||||
// PLAN_NAME = "年度安全培训计划"
|
||||
//};
|
||||
//NotificationTaskService.SendNotificationTask("年度安全培训计划", yearTrainPlan.ID, filter.GetOrgId(), user.ID, user.NAME, DateTime.Now, DateTime.Now.AddDays(15), 1, "SE012", () =>
|
||||
//{
|
||||
// AddEntityNoCommit(yearTrainPlan);
|
||||
//});
|
||||
T_SE_TRAIN_PLAN yearTrainPlan = new T_SE_TRAIN_PLAN
|
||||
{
|
||||
ID = Guid.NewGuid(),
|
||||
PLAN_YEAR = year,
|
||||
LAUNCH_TIME = dt,
|
||||
LAUNCH_DEPARTMENT_ID = user.DEPARTMENT_ID,
|
||||
TYPE = PlanType.Company,
|
||||
YEAR = year,
|
||||
LAUNCH_TIME = dtNow,
|
||||
DEPARTMENT_ID = user.DEPARTMENT_ID,
|
||||
LAUNCH_USER_ID = user.ID,
|
||||
STATUS = PFStandardStatus.Draft,
|
||||
ORG_ID = filter.GetOrgId(),
|
||||
PLAN_NAME = "年度安全培训计划"
|
||||
};
|
||||
NotificationTaskService.SendNotificationTask("年度安全培训计划", yearTrainPlan.ID, filter.GetOrgId(), user.ID, user.NAME, DateTime.Now, DateTime.Now.AddDays(15), 1, "SE012", () =>
|
||||
NotificationTaskService.SendNotificationTask("年度安全培训计划", yearTrainPlan.ID, filter.GetOrgId(), user.ID, user.NAME, DateTime.Now, DateTime.Now.AddDays(15), 1, "SE071", () =>
|
||||
{
|
||||
AddEntityNoCommit(yearTrainPlan);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user