安全会议,教育培训接口
This commit is contained in:
@@ -42,11 +42,15 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static List<Model.Training_Plan> GetThisYearPlanByCompanyTrainingItemId(string projectId, string itemId, int year)
|
||||
{
|
||||
return db.Training_Plan.Where(e => e.ProjectId == projectId && e.CompanyTrainingItemId == itemId && e.IsRetakeCourse != 1 && ((DateTime)e.DesignerDate).Year == year).ToList();
|
||||
var list = db.Training_Plan.Where(e => e.CompanyTrainingItemId == itemId && e.IsRetakeCourse != 1 && ((DateTime)e.DesignerDate).Year == year).ToList();
|
||||
if (!string.IsNullOrWhiteSpace(projectId))
|
||||
{
|
||||
list = list.Where(x => x.ProjectId == projectId).ToList();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加培训计划
|
||||
/// </summary>
|
||||
@@ -297,86 +301,103 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
//生成培训计划
|
||||
string planId = SQLHelper.GetNewID();
|
||||
string code = ProjectService.GetProjectByProjectId(info.CurrProjectId).ProjectCode + "-";
|
||||
string planCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", info.CurrProjectId, code);
|
||||
#region 生成培训计划
|
||||
|
||||
Model.Training_Plan planModel = new Model.Training_Plan
|
||||
List<string> projectIds = new List<string>();
|
||||
if (!string.IsNullOrWhiteSpace(info.CurrProjectId))
|
||||
{
|
||||
PlanId = planId,
|
||||
PlanCode = planCode,
|
||||
ProjectId = info.CurrProjectId,
|
||||
DesignerId = info.CurrUserId,
|
||||
DesignerDate = DateTime.Now,
|
||||
PlanName = companyTrainingItem.CompanyTrainingItemName,
|
||||
TrainContent = companyTrainingItem.CompanyTrainingItemName,
|
||||
TrainStartDate = DateTime.Now,
|
||||
TrainEndDate = info.TrainEndDate,
|
||||
TeachHour = teachHour,
|
||||
//TeachMan = companyTrainingItem.,
|
||||
//TeachAddress = model.TeachAddress,
|
||||
TrainTypeId = Const.EntryTrainTypeId,
|
||||
TrainLevelId = Const.OtherTrainLevelId,
|
||||
UnitIds = unitIds,
|
||||
WorkPostId = companyTrainingItem.WorkPostIds,
|
||||
States = "1",
|
||||
Cycle = "",
|
||||
//IsRetakeCourse = 0,
|
||||
//CheckType = info.CheckType.ToString(),
|
||||
//CheckId = info.CheckId,
|
||||
CompanyTrainingItemId = info.CompanyTrainingItemId
|
||||
};
|
||||
AddPlan(planModel);
|
||||
|
||||
//新增培训明细
|
||||
Model.Training_PlanItem newPlanItem = new Model.Training_PlanItem
|
||||
projectIds.Add(info.CurrProjectId);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlanItemId = SQLHelper.GetNewID(),
|
||||
PlanId = planId,
|
||||
CompanyTrainingItemId = info.CompanyTrainingItemId,
|
||||
CompanyTrainingId = companyTrainingItem.CompanyTrainingId
|
||||
};
|
||||
TrainingPlanItemService.AddPlanItem(newPlanItem);
|
||||
|
||||
List<Training_Task> newTasks = new List<Training_Task>();
|
||||
List<Training_TaskItem> newTaskItems = new List<Training_TaskItem>();
|
||||
//循环给人员添加任务
|
||||
foreach (var person in workPostPersons)
|
||||
{
|
||||
string taskId = SQLHelper.GetNewID();
|
||||
//新增培训任务
|
||||
Model.Training_Task newTask = new Model.Training_Task
|
||||
{
|
||||
TaskId = taskId,
|
||||
ProjectId = info.CurrProjectId,
|
||||
PlanId = planId,
|
||||
UserId = person.PersonId,
|
||||
TaskDate = DateTime.Now,
|
||||
States = Const.State_1,
|
||||
};
|
||||
newTasks.Add(newTask);
|
||||
|
||||
//新增培训任务明细
|
||||
Model.Training_TaskItem newTaskItem = new Model.Training_TaskItem
|
||||
{
|
||||
TaskItemId = SQLHelper.GetNewID(),
|
||||
TaskId = taskId,
|
||||
PlanId = planId,
|
||||
PersonId = person.PersonId,
|
||||
TrainingItemCode = companyTrainingItem.CompanyTrainingItemCode,
|
||||
TrainingItemName = companyTrainingItem.CompanyTrainingItemName,
|
||||
AttachUrl = companyTrainingItem.AttachUrl,
|
||||
CompanyTrainingItemId = info.CompanyTrainingItemId,
|
||||
//LearnTime = trainingItem.LearningTime,
|
||||
//VideoProgress = 0,
|
||||
};
|
||||
newTaskItems.Add(newTaskItem);
|
||||
var getProjects = ProjectService.GetProjectWorkList();
|
||||
projectIds = getProjects.Select(x => x.ProjectId).ToList();
|
||||
}
|
||||
|
||||
db.Training_Task.InsertAllOnSubmit(newTasks);
|
||||
db.Training_TaskItem.InsertAllOnSubmit(newTaskItems);
|
||||
db.SubmitChanges();
|
||||
foreach (var pid in projectIds)
|
||||
{
|
||||
string planId = SQLHelper.GetNewID();
|
||||
string code = ProjectService.GetProjectByProjectId(pid).ProjectCode + "-";
|
||||
string planCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", pid, code);
|
||||
|
||||
Model.Training_Plan planModel = new Model.Training_Plan
|
||||
{
|
||||
PlanId = planId,
|
||||
PlanCode = planCode,
|
||||
ProjectId = pid,
|
||||
DesignerId = info.CurrUserId,
|
||||
DesignerDate = DateTime.Now,
|
||||
PlanName = companyTrainingItem.CompanyTrainingItemName,
|
||||
TrainContent = companyTrainingItem.CompanyTrainingItemName,
|
||||
TrainStartDate = DateTime.Now,
|
||||
TrainEndDate = info.TrainEndDate,
|
||||
TeachHour = teachHour,
|
||||
//TeachMan = companyTrainingItem.,
|
||||
//TeachAddress = model.TeachAddress,
|
||||
TrainTypeId = Const.EntryTrainTypeId,
|
||||
TrainLevelId = Const.OtherTrainLevelId,
|
||||
UnitIds = unitIds,
|
||||
WorkPostId = companyTrainingItem.WorkPostIds,
|
||||
States = "1",
|
||||
Cycle = "",
|
||||
//IsRetakeCourse = 0,
|
||||
//CheckType = info.CheckType.ToString(),
|
||||
//CheckId = info.CheckId,
|
||||
CompanyTrainingItemId = info.CompanyTrainingItemId
|
||||
};
|
||||
AddPlan(planModel);
|
||||
|
||||
//新增培训明细
|
||||
Model.Training_PlanItem newPlanItem = new Model.Training_PlanItem
|
||||
{
|
||||
PlanItemId = SQLHelper.GetNewID(),
|
||||
PlanId = planId,
|
||||
CompanyTrainingItemId = info.CompanyTrainingItemId,
|
||||
CompanyTrainingId = companyTrainingItem.CompanyTrainingId
|
||||
};
|
||||
TrainingPlanItemService.AddPlanItem(newPlanItem);
|
||||
|
||||
List<Training_Task> newTasks = new List<Training_Task>();
|
||||
List<Training_TaskItem> newTaskItems = new List<Training_TaskItem>();
|
||||
//循环给人员添加任务
|
||||
foreach (var person in workPostPersons)
|
||||
{
|
||||
string taskId = SQLHelper.GetNewID();
|
||||
//新增培训任务
|
||||
Model.Training_Task newTask = new Model.Training_Task
|
||||
{
|
||||
TaskId = taskId,
|
||||
ProjectId = pid,
|
||||
PlanId = planId,
|
||||
UserId = person.PersonId,
|
||||
TaskDate = DateTime.Now,
|
||||
States = Const.State_1,
|
||||
};
|
||||
newTasks.Add(newTask);
|
||||
|
||||
//新增培训任务明细
|
||||
Model.Training_TaskItem newTaskItem = new Model.Training_TaskItem
|
||||
{
|
||||
TaskItemId = SQLHelper.GetNewID(),
|
||||
TaskId = taskId,
|
||||
PlanId = planId,
|
||||
PersonId = person.PersonId,
|
||||
TrainingItemCode = companyTrainingItem.CompanyTrainingItemCode,
|
||||
TrainingItemName = companyTrainingItem.CompanyTrainingItemName,
|
||||
AttachUrl = companyTrainingItem.AttachUrl,
|
||||
CompanyTrainingItemId = info.CompanyTrainingItemId,
|
||||
//LearnTime = trainingItem.LearningTime,
|
||||
//VideoProgress = 0,
|
||||
};
|
||||
newTaskItems.Add(newTaskItem);
|
||||
}
|
||||
|
||||
db.Training_Task.InsertAllOnSubmit(newTasks);
|
||||
db.Training_TaskItem.InsertAllOnSubmit(newTaskItems);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -336,7 +336,7 @@ namespace BLL
|
||||
{
|
||||
foreach (var work in workPostIds)
|
||||
{
|
||||
var plist = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && x.ProjectId == projectId && x.WorkPostId == work select x).ToList();
|
||||
var plist = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && x.WorkPostId == work select x).ToList();
|
||||
if (plist.Any())
|
||||
{
|
||||
list.AddRange(plist);
|
||||
@@ -345,7 +345,12 @@ namespace BLL
|
||||
}
|
||||
else
|
||||
{
|
||||
list = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && x.ProjectId == projectId select x).ToList();
|
||||
list = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true select x).ToList();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(projectId))
|
||||
{
|
||||
list = list.Where(x => x.ProjectId == projectId).ToList();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user