Compare commits

..

No commits in common. "078de1ef083cc9950b27ac2fded64ee789107683" and "4d98f1efd922525096fb80f965de439be1b0b4b2" have entirely different histories.

View File

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