This commit is contained in:
2025-02-25 16:41:06 +08:00
parent ca8be515a9
commit b7c8a426bf
87 changed files with 5778 additions and 1835 deletions
+165
View File
@@ -468,6 +468,171 @@ namespace BLL
#endregion
#region
/// <summary>
/// 根据培训类型获取项目培训人员信息
/// </summary>
/// <param name="projectId">项目ID</param>
/// <param name="unitIds">培训单位ID</param>
/// <param name="workPostIds">培训岗位ID</param>
/// <param name="trainTypeId">培训类型ID</param>
/// <returns></returns>
public static List<Model.PersonItem> getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string departIds, string trainTypeId, string InTime, string strParam)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
DateTime inDateTime = DateTime.Now;
if (!string.IsNullOrEmpty(InTime) && !"null".Equals(InTime))
{
inDateTime = DateTime.Parse(InTime);
}
List<string> unitIdList = Funs.GetStrListByStr(unitIds, ',');
var getPersons = (from x in db.View_SitePerson_Person
where x.ProjectId == projectId && unitIdList.Contains(x.UnitId) && x.IsUsed == true && (string.IsNullOrEmpty(strParam) || x.PersonName.Contains(strParam)) && (string.IsNullOrEmpty(InTime) || x.InTime < inDateTime)
&& x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime >= DateTime.Now)
select new Model.PersonItem
{
PersonId = x.PersonId,
CardNo = x.CardNo,
PersonName = x.PersonName,
SexName = x.SexName,
IdentityCard = x.IdentityCard,
Address = x.Address,
ProjectId = x.ProjectId,
ProjectCode = x.ProjectCode,
ProjectName = x.ProjectName,
UnitId = x.UnitId,
UnitCode = x.UnitCode,
UnitName = x.UnitName,
TeamGroupId = x.TeamGroupId,
TeamGroupName = x.TeamGroupName,
WorkPostId = x.WorkPostId,
WorkPostName = x.WorkPostName,
InTime = string.Format("{0:yyyy-MM-dd}", x.InTime),
OutTime = string.Format("{0:yyyy-MM-dd}", x.OutTime),
OutResult = x.OutResult,
Telephone = x.Telephone,
PhotoUrl = x.PhotoUrl,
DepartName = x.DepartName,
}).ToList();
if (!string.IsNullOrEmpty(workPostIds))
{
List<string> workPostIdList = Funs.GetStrListByStr(workPostIds, ',');
getPersons = getPersons.Where(x => workPostIdList.Contains(x.WorkPostId)).ToList();
}
if (!string.IsNullOrEmpty(trainTypeId) && trainTypeId == Const.SpecialSafeTrainId)//专项安全培训
{
var ids = db.Base_WorkPost.Where(x => x.PostType == "2").Select(x => x.WorkPostId).ToList();
getPersons = getPersons.Where(x => ids.Contains(x.WorkPostId)).ToList();
}
List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
var getTrainType = TrainTypeService.GetTrainTypeById(trainTypeId);
if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat.Value == false))
{
int score = 80;
var sysTestRule = db.Sys_TestRule.FirstOrDefault();
if (sysTestRule != null)
{
if (sysTestRule.PassingScore > 0)
{
score = sysTestRule.PassingScore;
}
}
foreach (var item in getPersons)
{
var getTrainPersonIdList3 = (from x in db.Training_TestRecord
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId
where x.TestScores > score
select x).FirstOrDefault();
if (getTrainPersonIdList3 != null)
{
continue;
}
var getTrainPersonIdList1 = (from x in db.EduTrain_TrainRecordDetail
join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId
where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && x.CheckResult == true && x.PersonId == item.PersonId
select x).FirstOrDefault();
if (getTrainPersonIdList1 == null)
{
var getTrainPersonIdList2 = (from x in db.Training_Task
join y in db.Training_Plan on x.PlanId equals y.PlanId
where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId
select x).FirstOrDefault();
if (getTrainPersonIdList2 == null)
{
getTrainPersonList.Add(item);
}
}
}
return getTrainPersonList;
}
else if (getTrainType != null && getTrainType.IsRepeat.HasValue && getTrainType.IsRepeat.Value == true)//重复的 过滤人员
{
foreach (var item in getPersons)
{
//int score = 80;
//var sysTestRule = db.Sys_TestRule.FirstOrDefault();
//if (sysTestRule != null)
//{
// if (sysTestRule.PassingScore > 0)
// {
// score = sysTestRule.PassingScore;
// }
//}
//var getTrainPersonIdList2 = (from x in db.Training_TestRecord
// join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
// where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId
// where x.TestScores > score
// select x).FirstOrDefault();
//if (getTrainPersonIdList2 != null)
//{
// continue;
//}
getTrainPersonList.Add(item);
}
return getTrainPersonList;
}
//else if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))//重复的 过滤人员
//{
// int score = 80;
// var sysTestRule = db.Sys_TestRule.FirstOrDefault();
// if (sysTestRule != null)
// {
// if (sysTestRule.PassingScore > 0)
// {
// score = sysTestRule.PassingScore;
// }
// }
// foreach (var item in getPersons)
// {
// var getTrainPersonIdList2 = (from x in db.Training_TestRecord
// join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
// where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId
// where x.TestScores > score
// select x).FirstOrDefault();
// if (getTrainPersonIdList2 != null)
// {
// continue;
// }
// getTrainPersonList.Add(item);
// }
// return getTrainPersonList;
//}
else
{
return getPersons.ToList();
}
}
}
/// <summary>
/// 根据培训类型获取项目培训人员信息
/// </summary>
+2 -1
View File
@@ -51,7 +51,7 @@ namespace BLL
/// </summary>
/// <param name="teamGroup"></param>
public static void UpdateWorkPost(Model.Base_WorkPost workPost)
{
{
Model.SGGLDB db = Funs.DB;
Model.Base_WorkPost newWorkPost = db.Base_WorkPost.FirstOrDefault(e => e.WorkPostId == workPost.WorkPostId);
if (newWorkPost != null)
@@ -260,5 +260,6 @@ namespace BLL
return workPostName;
}
#endregion
}
}
+9 -1
View File
@@ -907,7 +907,7 @@ namespace BLL
#region
/// <summary>
/// 天辰单位id
/// 新疆油建单位id
/// </summary>
public const string UnitId_TCC = "b4f3d912-ca6d-440c-a8d7-bc6a5d5a1f84";
/// <summary>
@@ -3630,6 +3630,10 @@ namespace BLL
/// 岗位培训标准
/// </summary>
public const string PostTrainingStandardTemplateUrl = "File\\Excel\\DataIn\\岗位培训标准导入模板.xlsx";
/// <summary>
/// 岗位培训人员导入模板
/// </summary>
public const string PostTrainingRecordTemplateUrl = "File\\Excel\\DataIn\\岗位培训人员导入模板.xls";
/// <summary>
/// 数据导入模版文件原始的虚拟路径
@@ -6327,6 +6331,10 @@ namespace BLL
/// 实业数据
/// </summary>
public const string Project_SYHSEData_SYHSEMenuId = "";
/// <summary>
/// 专项安全培训 id
/// </summary>
public static string SpecialSafeTrainId = "0e7fdf78-eaa0-4d00-a60b-490040bbea18";
#endregion
/// <summary>
@@ -22,35 +22,39 @@ namespace BLL
/// <summary>
/// 添加公司培训明细
/// </summary>
/// <param name="companyTrainingItem"></param>
public static void AddCompanyTrainingItem(Model.Training_CompanyTrainingItem companyTrainingItem)
/// <param name="model"></param>
public static void AddCompanyTrainingItem(Model.Training_CompanyTrainingItem model)
{
Model.Training_CompanyTrainingItem newCompanyTrainingItem = new Model.Training_CompanyTrainingItem();
newCompanyTrainingItem.CompanyTrainingItemId = companyTrainingItem.CompanyTrainingItemId;
newCompanyTrainingItem.CompanyTrainingId = companyTrainingItem.CompanyTrainingId;
newCompanyTrainingItem.CompanyTrainingItemCode = companyTrainingItem.CompanyTrainingItemCode;
newCompanyTrainingItem.CompanyTrainingItemName = companyTrainingItem.CompanyTrainingItemName;
newCompanyTrainingItem.AttachUrl = companyTrainingItem.AttachUrl;
newCompanyTrainingItem.CompileMan = companyTrainingItem.CompileMan;
newCompanyTrainingItem.CompileDate = companyTrainingItem.CompileDate;
db.Training_CompanyTrainingItem.InsertOnSubmit(newCompanyTrainingItem);
Model.Training_CompanyTrainingItem newModel = new Model.Training_CompanyTrainingItem();
newModel.CompanyTrainingItemId = model.CompanyTrainingItemId;
newModel.CompanyTrainingId = model.CompanyTrainingId;
newModel.CompanyTrainingItemCode = model.CompanyTrainingItemCode;
newModel.CompanyTrainingItemName = model.CompanyTrainingItemName;
newModel.AttachUrl = model.AttachUrl;
newModel.CompileMan = model.CompileMan;
newModel.CompileDate = model.CompileDate;
newModel.WorkPostIds = model.WorkPostIds;
newModel.WorkPostNames = model.WorkPostNames;
db.Training_CompanyTrainingItem.InsertOnSubmit(newModel);
db.SubmitChanges();
}
/// <summary>
/// 修改公司培训明细
/// </summary>
/// <param name="companyTrainingItem"></param>
public static void UpdateCompanyTrainingItem(Model.Training_CompanyTrainingItem companyTrainingItem)
/// <param name="model"></param>
public static void UpdateCompanyTrainingItem(Model.Training_CompanyTrainingItem model)
{
Model.Training_CompanyTrainingItem newCompanyTrainingItem = db.Training_CompanyTrainingItem.FirstOrDefault(e => e.CompanyTrainingItemId == companyTrainingItem.CompanyTrainingItemId);
if (newCompanyTrainingItem != null)
Model.Training_CompanyTrainingItem newModel = db.Training_CompanyTrainingItem.FirstOrDefault(e => e.CompanyTrainingItemId == model.CompanyTrainingItemId);
if (newModel != null)
{
newCompanyTrainingItem.CompanyTrainingItemCode = companyTrainingItem.CompanyTrainingItemCode;
newCompanyTrainingItem.CompanyTrainingItemName = companyTrainingItem.CompanyTrainingItemName;
newCompanyTrainingItem.AttachUrl = companyTrainingItem.AttachUrl;
newCompanyTrainingItem.CompileMan = companyTrainingItem.CompileMan;
newCompanyTrainingItem.CompileDate = companyTrainingItem.CompileDate;
newModel.CompanyTrainingItemCode = model.CompanyTrainingItemCode;
newModel.CompanyTrainingItemName = model.CompanyTrainingItemName;
newModel.AttachUrl = model.AttachUrl;
newModel.CompileMan = model.CompileMan;
newModel.CompileDate = model.CompileDate;
newModel.WorkPostIds = model.WorkPostIds;
newModel.WorkPostNames = model.WorkPostNames;
db.SubmitChanges();
}
}
@@ -61,10 +65,10 @@ namespace BLL
/// <param name="companyTrainItemId"></param>
public static void DeleteCompanyTrainingItemById(string companyTrainItemId)
{
Model.Training_CompanyTrainingItem companyTrainingItem = db.Training_CompanyTrainingItem.FirstOrDefault(e => e.CompanyTrainingItemId == companyTrainItemId);
if (companyTrainingItem != null)
Model.Training_CompanyTrainingItem model = db.Training_CompanyTrainingItem.FirstOrDefault(e => e.CompanyTrainingItemId == companyTrainItemId);
if (model != null)
{
db.Training_CompanyTrainingItem.DeleteOnSubmit(companyTrainingItem);
db.Training_CompanyTrainingItem.DeleteOnSubmit(model);
db.SubmitChanges();
}
}
@@ -42,7 +42,8 @@ namespace BLL
Method = model.Method,
Lecturer = model.Lecturer,
UnitIds = model.UnitIds,
RoleIds = model.RoleIds,
//RoleIds = model.RoleIds,
WorkPostIds = model.WorkPostIds,
PersonNum = model.PersonNum,
TrainingTime = model.TrainingTime,
Duration = model.Duration,
@@ -74,7 +75,8 @@ namespace BLL
newModel.Method = model.Method;
newModel.Lecturer = model.Lecturer;
newModel.UnitIds = model.UnitIds;
newModel.RoleIds = model.RoleIds;
newModel.WorkPostIds = model.WorkPostIds;
//newModel.RoleIds = model.RoleIds;
newModel.PersonNum = model.PersonNum;
newModel.TrainingTime = model.TrainingTime;
newModel.Duration = model.Duration;
@@ -32,7 +32,8 @@ namespace BLL
{
Id = model.Id,
Code = model.Code,
RoleId = model.RoleId,
//RoleId = model.RoleId,
WorkPostId = model.WorkPostId,
CourseId = model.CourseId,
ClassHour = model.ClassHour,
Cycle = model.Cycle,
@@ -57,7 +58,8 @@ namespace BLL
if (newModel != null)
{
newModel.Code = model.Code;
newModel.RoleId = model.RoleId;
//newModel.RoleId = model.RoleId;
newModel.WorkPostId = model.WorkPostId;
newModel.CourseId = model.CourseId;
newModel.ClassHour = model.ClassHour;
newModel.Cycle = model.Cycle;
@@ -102,12 +104,15 @@ namespace BLL
var db = Funs.DB;
var lst = (from x in db.PostTraining_Standard
join y in db.PostTraining_Course on x.CourseId equals y.Id
join z in db.PostTraining_Role on x.RoleId equals z.Id
join z in db.Base_WorkPost on x.WorkPostId equals z.WorkPostId
//join z in db.PostTraining_Role on x.RoleId equals z.Id
orderby x.Code
select new PostTrainingStandardInfo
{
RoleId = x.RoleId,
RoleName = z.Name,
WorkPostId = x.WorkPostId,
WorkPostName = z.WorkPostName,
//RoleId = x.RoleId,
//RoleName = z.RoleName,
CourseId = x.CourseId,
CourseName = y.Name,
CategoryName = y.CategoryName,
@@ -155,8 +160,9 @@ namespace BLL
var lstStandard = GetStandardInfoList();
//培训课程
var lstCourse = PostTrainingCourseService.GetCourseList();
//培训角色
var lstRole = PostTrainingRoleService.GetRoleList();
////培训角色
//var lstRole = PostTrainingRoleService.GetRoleList();
var lstWorkPost = WorkPostService.GetWorkPostList();
//培训类别
var lstCategory = PostTrainingCategoryService.GetCategoryList();
//培训方式
@@ -186,7 +192,7 @@ namespace BLL
if (!string.IsNullOrWhiteSpace(roleName))
{
if (!lstRole.Where(x => x.Name == roleName).Any())
if (!lstWorkPost.Where(x => x.WorkPostName == roleName).Any())
{
Model.ErrorInfo errorInfo = new Model.ErrorInfo();
errorInfo.Row = rowIndex.ToString();
@@ -392,7 +398,8 @@ namespace BLL
CompileMan = creatUserId
};
newModel.CourseId = lstCourse.Where(x => x.Name == courseName).FirstOrDefault().Id;
newModel.RoleId = lstRole.Where(x => x.Name == roleName).FirstOrDefault().Id;
//newModel.RoleId = lstRole.Where(x => x.Name == roleName).FirstOrDefault().Id;
newModel.WorkPostId = lstWorkPost.Where(x => x.WorkPostName == roleName).FirstOrDefault().WorkPostId;
newModel.ClassHour = classHour;
newModel.Cycle = cycle;
newModel.Method = method;
+2 -2
View File
@@ -344,7 +344,7 @@ namespace BLL
TeamGroupId = person.TeamGroupId,
WorkAreaId = person.WorkAreaId,
WorkPostId = person.WorkPostId,
PostTrainingRoleId = person.PostTrainingRoleId,
//PostTrainingRoleId = person.PostTrainingRoleId,
OutTime = person.OutTime,
OutResult = person.OutResult,
Telephone = person.Telephone,
@@ -424,7 +424,7 @@ namespace BLL
newPerson.TeamGroupId = person.TeamGroupId;
newPerson.WorkAreaId = person.WorkAreaId;
newPerson.WorkPostId = person.WorkPostId;
newPerson.PostTrainingRoleId = person.PostTrainingRoleId;
//newPerson.PostTrainingRoleId = person.PostTrainingRoleId;
newPerson.InTime = person.InTime;
newPerson.OutTime = person.OutTime;
newPerson.IsSafetyMonitoring = person.IsSafetyMonitoring;
+64 -7
View File
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
@@ -12,7 +10,7 @@ namespace BLL
/// <summary>
/// 根据主键获取信息
/// </summary>
/// <param name="groupId"></param>
/// <param name="departId"></param>
/// <returns></returns>
public static Model.Base_Depart GetDepartById(string departId)
{
@@ -22,7 +20,7 @@ namespace BLL
/// <summary>
/// 添加
/// </summary>
/// <param name="?"></param>
/// <param name="depart"></param>
public static void AddDepart(Model.Base_Depart depart)
{
Model.SGGLDB db = Funs.DB;
@@ -41,7 +39,7 @@ namespace BLL
/// <summary>
/// 修改
/// </summary>
/// <param name="teamGroup"></param>
/// <param name="depart"></param>
public static void UpdateDepart(Model.Base_Depart depart)
{
Model.SGGLDB db = Funs.DB;
@@ -82,7 +80,7 @@ namespace BLL
/// <summary>
/// 根据主键获取信息
/// </summary>
/// <param name="groupId"></param>
/// <param name="departId"></param>
/// <returns></returns>
public static string getDepartNameById(string departId)
{
@@ -113,5 +111,64 @@ namespace BLL
}
}
#endregion
#region ID得到岗位名称字符串
/// <summary>
/// 根据多部门ID得到岗位名称字符串
/// </summary>
/// <param name="departIdsIds"></param>
/// <returns></returns>
public static string getDepartNamesByIds(object departIdsIds)
{
string departName = string.Empty;
if (departIdsIds != null)
{
string[] ids = departIdsIds.ToString().Split(',');
foreach (string id in ids)
{
var q = GetDepartById(id);
if (q != null)
{
departName += q.DepartName + ",";
}
}
if (departName != string.Empty)
{
departName = departName.Substring(0, departName.Length - 1); ;
}
}
return departName;
}
public static string getDepartNamesByIdsForApi(object departIdsIds)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
string departName = string.Empty;
if (departIdsIds != null)
{
string[] ids = departIdsIds.ToString().Split(',');
foreach (string id in ids)
{
var q = db.Base_Depart.FirstOrDefault(e => e.DepartId == id);
if (q != null)
{
departName += q.DepartName + ",";
}
}
if (departName != string.Empty)
{
departName = departName.Substring(0, departName.Length - 1); ;
}
}
return departName;
}
}
#endregion
}
}