Merge branch 'master' of http://121.41.2.71:3000/wyw/mh_jy_safe
This commit is contained in:
commit
4ef517acce
@ -85,7 +85,8 @@ 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);
|
||||||
//培训通知
|
//培训通知
|
||||||
@ -1308,12 +1309,12 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private JsonActionResult<bool> CreateYearTrainPlan([FromBody] KeywordFilter filter)
|
private JsonActionResult<bool> CreateYearTrainPlan(KeywordFilter filter, DateTime dtNow, T_SE_SECONFIG config)
|
||||||
{
|
{
|
||||||
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)
|
||||||
@ -1321,10 +1322,14 @@ 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 == dt.Month && dd == dt.Day)
|
if (mm == dtNow.Month && dd == dtNow.Day)
|
||||||
{
|
{
|
||||||
int year = int.Parse(dt.Year.ToString());
|
int year = int.Parse(dtNow.Year.ToString());
|
||||||
var yearPlan = this.GetEntity<T_SE_YEAR_TRAIN_PLAN>(e => e.PLAN_YEAR == year || e.PLAN_YEAR == year + 1);
|
if (mm > 9)
|
||||||
|
{
|
||||||
|
year++;//超过9月算 制定 明年的代办
|
||||||
|
}
|
||||||
|
var yearPlan = this.GetEntity<T_SE_TRAIN_PLAN>(e => e.YEAR == year);
|
||||||
if (yearPlan != null)
|
if (yearPlan != null)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -1333,20 +1338,44 @@ 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(),
|
||||||
PLAN_YEAR = year,
|
TYPE = PlanType.Company,
|
||||||
LAUNCH_TIME = dt,
|
YEAR = year,
|
||||||
LAUNCH_DEPARTMENT_ID = user.DEPARTMENT_ID,
|
LAUNCH_TIME = dtNow,
|
||||||
|
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, "SE012", () =>
|
NotificationTaskService.SendNotificationTask("年度安全培训计划", yearTrainPlan.ID, filter.GetOrgId(), user.ID, user.NAME, DateTime.Now, DateTime.Now.AddDays(15), 1, "SE071", () =>
|
||||||
{
|
{
|
||||||
AddEntityNoCommit(yearTrainPlan);
|
AddEntityNoCommit(yearTrainPlan);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user