检查关联培训

This commit is contained in:
2026-11-19 16:31:11 +08:00
parent 461bca785b
commit 8490311e94
22 changed files with 442 additions and 132 deletions
@@ -1,4 +1,6 @@
using System.Collections.Generic;
using System;
using Model;
using System.Collections.Generic;
using System.Linq;
namespace BLL
@@ -117,5 +119,49 @@ namespace BLL
return lst;
}
#region BoundTree
/// <summary>
/// 加载培训教材
/// </summary>
/// <param name="myList"></param>
/// <param name="menuId"></param>
/// <param name="depth"></param>
public static void BoundTree(List<JQueryFeature> myList, string menuId, int depth)
{
var dt = GetNewTraining(menuId);
if (dt.Count() > 0)
{
foreach (var dr in dt)
{
myList.Add(new JQueryFeature(dr.CompanyTrainingId, dr.CompanyTrainingName, depth, false));
BoundTree(myList, dr.CompanyTrainingId, depth + 1);
}
}
else
{
var item = Funs.DB.Training_CompanyTrainingItem.Where(x => x.CompanyTrainingId == menuId).OrderBy(x => x.CompanyTrainingItemCode);
if (item.Count() > 0)
{
foreach (var dr in item)
{
myList.Add(new JQueryFeature(dr.CompanyTrainingItemId, dr.CompanyTrainingItemName, depth, true));
}
}
}
}
/// <summary>
/// 得到菜单方法
/// </summary>
/// <param name="parentId"></param>
/// <returns></returns>
public static List<Model.Training_CompanyTraining> GetNewTraining(string parentId)
{
return (from x in Funs.DB.Training_CompanyTraining where x.SupCompanyTrainingId == parentId orderby x.CompanyTrainingCode select x).ToList(); ;
}
#endregion
}
}
@@ -11,7 +11,7 @@ namespace BLL
/// </summary>
public static class TrainingPlanService
{
/// <summary>
/// 根据主键获取培训计划
@@ -172,6 +172,7 @@ namespace BLL
var plan = GetPlanByCheckId(info.CheckId);
var person = PersonService.GetPersonById(info.PersonId);
var companyTrainingItem = CompanyTrainingItemService.GetCompanyTrainingItemById(info.CompanyTrainingItemId);
//var teachHour = companyTrainingItem.LearningTime != null ? companyTrainingItem.LearningTime / 3600 : 0;
var teachHour = companyTrainingItem.LearningTime / 3600;
string planId = string.Empty;
@@ -189,7 +190,7 @@ namespace BLL
TrainStartDate = plan.TrainStartDate,
TrainEndDate = info.TrainEndDate,
TeachMan = plan.TeachMan,
TeachAddress = plan.TeachAddress,
TeachAddress = !string.IsNullOrWhiteSpace(plan.TeachAddress) ? plan.TeachAddress : "小程序线上培训",
TrainTypeId = Const.RetakeCourseTrainTypeId,
TrainLevelId = Const.OtherTrainLevelId,
States = "1",
@@ -204,8 +205,8 @@ namespace BLL
else
{//生成培训计划
planId = SQLHelper.GetNewID();
string code = ProjectService.GetProjectByProjectId(info.CurrProjectId).ProjectCode + "-";
string planCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", info.CurrProjectId, code);
string code = $"{(!string.IsNullOrWhiteSpace(info.CurrProjectId) ? ProjectService.GetProjectByProjectId(info.CurrProjectId).ProjectCode : "HSE")}-";
string planCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", (!string.IsNullOrWhiteSpace(info.CurrProjectId) ? info.CurrProjectId : "HSE"), code);
Model.Training_Plan planModel = new Model.Training_Plan
{
@@ -221,6 +222,7 @@ namespace BLL
TeachHour = teachHour,
//TeachMan = model.TeachMan,
//TeachAddress = model.TeachAddress,
TeachAddress = "小程序线上培训",
TrainTypeId = Const.RetakeCourseTrainTypeId,
TrainLevelId = Const.OtherTrainLevelId,
UnitIds = person.UnitId,