1
This commit is contained in:
@@ -0,0 +1,339 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLL.API
|
||||
{
|
||||
public class APIIndexService
|
||||
{
|
||||
#region 获取HSSE首页数据
|
||||
/// <summary>
|
||||
/// 获取HSSE首页数据
|
||||
/// </summary>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.HSSEItem hsse()
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.HSSEItem item = new Model.HSSEItem();
|
||||
var hsse = db.HSSEData_HSSE.OrderByDescending(x => x.ReportDate).FirstOrDefault();
|
||||
if (hsse != null)
|
||||
{
|
||||
|
||||
item.Id = hsse.Id;
|
||||
item.UnitId = hsse.UnitId;
|
||||
item.CollCropCode = hsse.CollCropCode;
|
||||
item.UnitName = hsse.UnitName;
|
||||
item.ReportDate = hsse.ReportDate;
|
||||
item.BeUnderConstructionNum = hsse.BeUnderConstructionNum;
|
||||
item.ShutdownNum = hsse.ShutdownNum;
|
||||
item.JoinConstructionPersonNum = hsse.JoinConstructionPersonNum;
|
||||
item.MajorProjectsUnderConstructionNum = hsse.MajorProjectsUnderConstructionNum;
|
||||
item.TotalWorkingHour = hsse.TotalWorkingHour;
|
||||
item.TotalWorkingHour = hsse.TotalWorkingHour;
|
||||
item.SafeWorkingHour = hsse.SafeWorkingHour;
|
||||
item.SafeTrainNum = hsse.SafeTrainNum;
|
||||
item.SpecialTrainNum = hsse.SpecialTrainNum;
|
||||
item.SpecialOperationTrainNum = hsse.SpecialOperationTrainNum;
|
||||
item.TotalEnergyConsumption = hsse.TotalEnergyConsumption;
|
||||
item.IncomeComprehensiveEnergyConsumption = hsse.IncomeComprehensiveEnergyConsumption;
|
||||
item.NewWaterConsumption = hsse.NewWaterConsumption;
|
||||
item.HeadOfficeInspectorGeneralNum = hsse.HeadOfficeInspectorGeneralNum;
|
||||
item.HeadOfficeFullTimeNum = hsse.HeadOfficeFullTimeNum;
|
||||
item.BranchInspectorGeneralNum = hsse.BranchInspectorGeneralNum;
|
||||
item.BranchFullTimeNum = hsse.BranchFullTimeNum;
|
||||
item.ProjectInspectorGeneralNum = hsse.ProjectInspectorGeneralNum;
|
||||
item.ProjectFullTimeNum = hsse.ProjectFullTimeNum;
|
||||
item.ProjectSafetyMonitorNum = hsse.ProjectSafetyMonitorNum;
|
||||
item.SafetyInjectionEngineer = hsse.SafetyInjectionEngineer;
|
||||
item.CertificateANum = hsse.CertificateANum;
|
||||
item.CertificateBNum = hsse.CertificateBNum;
|
||||
item.CertificateCNum = hsse.CertificateCNum;
|
||||
item.SafetyCommitteeMeetingNum = hsse.SafetyCommitteeMeetingNum;
|
||||
item.EnterpriseTopicsMeetingNum = hsse.EnterpriseTopicsMeetingNum;
|
||||
item.ProjectSafetyLeadingGroupMeetingNum = hsse.ProjectSafetyLeadingGroupMeetingNum;
|
||||
item.ProjectSafetyMeetingNum = hsse.ProjectSafetyMeetingNum;
|
||||
item.CompanyLeadShiftCheckNum = hsse.CompanyLeadShiftCheckNum;
|
||||
item.CompanyComprehensiveCheckNum = hsse.CompanyComprehensiveCheckNum;
|
||||
item.CompanySpecialCheckNum = hsse.CompanySpecialCheckNum;
|
||||
item.ProjectLeadShiftCheckNum = hsse.ProjectLeadShiftCheckNum;
|
||||
item.ProjectSpecialCheckNum = hsse.ProjectSpecialCheckNum;
|
||||
item.ProjectMajorCheckNum = hsse.ProjectMajorCheckNum;
|
||||
item.NearMissNum = hsse.NearMissNum;
|
||||
item.RecordableEventNum = hsse.RecordableEventNum;
|
||||
item.GeneralAccidentNum = hsse.GeneralAccidentNum;
|
||||
item.MajorAccidentNum = hsse.MajorAccidentNum;
|
||||
item.SeriousAccidentNum = hsse.SeriousAccidentNum;
|
||||
item.SpecialSeriousAccidentNum = hsse.SpecialSeriousAccidentNum;
|
||||
item.CompanyComprehensivePlanNum = hsse.CompanyComprehensivePlanNum;
|
||||
item.CompanySpecialPlanNum = hsse.CompanySpecialPlanNum;
|
||||
item.CompanyOnSiteDisposalPlan = hsse.CompanyOnSiteDisposalPlan;
|
||||
item.CompanyDrillNum = hsse.CompanyDrillNum;
|
||||
item.ProjectComprehensivePlanNum = hsse.ProjectComprehensivePlanNum;
|
||||
item.ProjectSpecialPlanNum = hsse.ProjectSpecialPlanNum;
|
||||
item.ProjectOnSiteDisposalPlan = hsse.ProjectOnSiteDisposalPlan;
|
||||
item.ProjectDrillNum = hsse.ProjectDrillNum;
|
||||
item.CostExtract = hsse.CostExtract;
|
||||
item.CostUse = hsse.CostUse;
|
||||
item.UseEquipmentNum = hsse.UseEquipmentNum;
|
||||
item.SpecialEquipmentNum = hsse.SpecialEquipmentNum;
|
||||
item.LicensesNum = hsse.LicensesNum;
|
||||
item.LicensesCloseNum = hsse.LicensesCloseNum;
|
||||
item.GeneralClosedNum = hsse.GeneralClosedNum;
|
||||
item.GeneralNotClosedNum = hsse.GeneralNotClosedNum;
|
||||
item.MajorClosedNum = hsse.MajorClosedNum;
|
||||
item.MajorNotClosedNum = hsse.MajorNotClosedNum;
|
||||
item.GeneralRiskNum = hsse.GeneralRiskNum;
|
||||
item.LowRiskNum = hsse.LowRiskNum;
|
||||
item.MediumRiskNum = hsse.MediumRiskNum;
|
||||
item.HighRiskNum = hsse.HighRiskNum;
|
||||
item.CompletedNum = hsse.CompletedNum;
|
||||
item.TrainPersonNum = hsse.TrainPersonNum;
|
||||
item.ConstructionNum = hsse.ConstructionNum;
|
||||
item.FinishedNum = hsse.FinishedNum;
|
||||
item.SuperCompletedNum = hsse.SuperCompletedNum;
|
||||
item.SuperTrainPersonNum = hsse.SuperTrainPersonNum;
|
||||
item.SuperConstructionNum = hsse.SuperConstructionNum;
|
||||
item.SuperFinishedNum = hsse.SuperFinishedNum;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取HSSE首页隐患排查治理数据明细
|
||||
/// <summary>
|
||||
/// 获取HSSE首页隐患排查治理数据明细
|
||||
/// </summary>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.HiddenDangerItem> hiddenDanger()
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
List<Model.HiddenDangerItem> res = new List<Model.HiddenDangerItem>();
|
||||
var reportDate = Funs.DB.HSSEData_HiddenDangerDetail.Max(x => x.ReportDate);
|
||||
if (reportDate.HasValue)
|
||||
{
|
||||
var details = Funs.DB.HSSEData_HiddenDangerDetail.Where(x => x.ReportDate == reportDate.Value).ToList();
|
||||
|
||||
if (details != null && details.Count > 0)
|
||||
{
|
||||
foreach (var d in details)
|
||||
{
|
||||
Model.HiddenDangerItem item = new Model.HiddenDangerItem();
|
||||
item.Id = d.Id;
|
||||
item.UnitId = d.UnitId;
|
||||
item.CollCropCode = d.CollCropCode;
|
||||
item.UnitName = d.UnitName;
|
||||
item.ReportDate = d.ReportDate;
|
||||
item.TypeName = d.TypeName;
|
||||
item.TotalNum = d.TotalNum;
|
||||
item.NeedRectifyNum = d.NeedRectifyNum;
|
||||
res.Add(item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取CQMS首页
|
||||
/// <summary>
|
||||
/// 获取CQMS首页
|
||||
/// </summary>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.CQMSItem cqms()
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.CQMSItem item = new Model.CQMSItem();
|
||||
var cqms = db.CQMSData_CQMS.OrderByDescending(x => x.ReportDate).FirstOrDefault();
|
||||
if (cqms != null)
|
||||
{
|
||||
|
||||
item.Id = cqms.Id;
|
||||
item.UnitId = cqms.UnitId;
|
||||
item.CollCropCode = cqms.CollCropCode;
|
||||
item.UnitName = cqms.UnitName;
|
||||
item.ReportDate = cqms.ReportDate.Value.ToShortDateString();
|
||||
item.TrainPersonNum = cqms.TrainPersonNum;
|
||||
item.TechnicalDisclosePersonNum = cqms.TechnicalDisclosePersonNum;
|
||||
item.UseNum = cqms.UseNum;
|
||||
item.OKNum = cqms.OKNum;
|
||||
item.CompanyPersonNum = cqms.CompanyPersonNum;
|
||||
item.BranchPersonNum = cqms.BranchPersonNum;
|
||||
item.ProjectPersonNum = cqms.ProjectPersonNum;
|
||||
item.ProblemNum = cqms.ProblemNum;
|
||||
item.ProblemCompletedNum = cqms.ProblemCompletedNum;
|
||||
item.ProblemNotCompletedNum = cqms.ProblemNotCompletedNum;
|
||||
item.SNum = cqms.SNum;
|
||||
item.ANum = cqms.ANum;
|
||||
item.BNum = cqms.BNum;
|
||||
item.CNum = cqms.CNum;
|
||||
item.KeyProcessNum = cqms.KeyProcessNum;
|
||||
item.KeyProcessOKNum = cqms.KeyProcessOKNum;
|
||||
item.SpecialProcessNum = cqms.SpecialProcessNum;
|
||||
item.SpecialProcessOKNum = cqms.SpecialProcessOKNum;
|
||||
item.ConcealedWorksNum = cqms.ConcealedWorksNum;
|
||||
item.ConcealedWorksOKNum = cqms.ConcealedWorksOKNum;
|
||||
item.UnitProjectOnesNum = cqms.UnitProjectOnesNum;
|
||||
item.UnitProjectOnesOKNum = cqms.UnitProjectOnesOKNum;
|
||||
item.MaterialInRecheckNum = cqms.MaterialInRecheckNum;
|
||||
item.MaterialInRecheckOKNum = cqms.MaterialInRecheckOKNum;
|
||||
item.SingleProjectNum = cqms.SingleProjectNum;
|
||||
item.UnitProjectNum = cqms.UnitProjectNum;
|
||||
item.SubProjectNum = cqms.SubProjectNum;
|
||||
item.SubdivisionalWorksNum = cqms.SubdivisionalWorksNum;
|
||||
item.InspectionLotNum = cqms.InspectionLotNum;
|
||||
}
|
||||
return item;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取HJGL首页
|
||||
/// <summary>
|
||||
/// 获取HJGL首页
|
||||
/// </summary>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.HJGLItem hjgl()
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.HJGLItem item = new Model.HJGLItem();
|
||||
var hjgl = db.HJGLData_HJGL.OrderByDescending(x => x.ReportDate).FirstOrDefault();
|
||||
if (hjgl != null)
|
||||
{
|
||||
|
||||
item.Id = hjgl.Id;
|
||||
item.UnitId = hjgl.UnitId;
|
||||
item.CollCropCode = hjgl.CollCropCode;
|
||||
item.UnitName = hjgl.UnitName;
|
||||
item.ReportDate = hjgl.ReportDate;
|
||||
item.WelderNum = hjgl.WelderNum;
|
||||
item.TotalDineNum = hjgl.TotalDineNum;
|
||||
item.CompleteDineNum = hjgl.CompleteDineNum;
|
||||
item.TotalFilmNum = hjgl.TotalFilmNum;
|
||||
item.OKFilmNum = hjgl.OKFilmNum;
|
||||
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取焊接缺陷
|
||||
/// <summary>
|
||||
/// 获取焊接缺陷
|
||||
/// </summary>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.DefectItem> defect()
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
List<Model.DefectItem> res = new List<Model.DefectItem>();
|
||||
var reportDate = Funs.DB.HJGLData_Defect.Max(x => x.ReportDate);
|
||||
if (reportDate.HasValue)
|
||||
{
|
||||
var defects = Funs.DB.HJGLData_Defect.Where(x => x.ReportDate == reportDate.Value).ToList();
|
||||
|
||||
if (defects != null && defects.Count > 0)
|
||||
{
|
||||
foreach (var d in defects)
|
||||
{
|
||||
Model.DefectItem item = new Model.DefectItem();
|
||||
item.Id = d.Id;
|
||||
item.UnitId = d.UnitId;
|
||||
item.CollCropCode = d.CollCropCode;
|
||||
item.UnitName = d.UnitName;
|
||||
item.ReportDate = d.ReportDate;
|
||||
item.DefectName = d.DefectName;
|
||||
item.DefectNum = d.DefectNum;
|
||||
res.Add(item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取SHIYE首页
|
||||
/// <summary>
|
||||
/// 获取SHIYE首页
|
||||
/// </summary>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.SYHSEItem shiye()
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.SYHSEItem item = new Model.SYHSEItem();
|
||||
var shiye = db.SYHSEData_SYHSE.OrderByDescending(x => x.ReportDate).FirstOrDefault();
|
||||
if (shiye != null)
|
||||
{
|
||||
|
||||
item.Id = shiye.Id;
|
||||
item.UnitId = shiye.UnitId;
|
||||
item.CollCropCode = shiye.CollCropCode;
|
||||
item.UnitName = shiye.UnitName;
|
||||
item.ReportDate = shiye.ReportDate;
|
||||
item.GeneralRiskNum = shiye.GeneralRiskNum;
|
||||
item.LowRiskNum = shiye.LowRiskNum;
|
||||
item.MediumRiskNum = shiye.MediumRiskNum;
|
||||
item.HighRiskNum = shiye.HighRiskNum;
|
||||
item.GradedResponsiblePersonNum = shiye.GradedResponsiblePersonNum;
|
||||
item.ChargeInsurancePersonNum = shiye.ChargeInsurancePersonNum;
|
||||
item.DesignQuantity = shiye.DesignQuantity;
|
||||
item.RunningCapacity = shiye.DesignQuantity;
|
||||
item.InterlockSettingValue = shiye.InterlockSettingValue;
|
||||
item.VideoSurveillanceNum = shiye.VideoSurveillanceNum;
|
||||
item.TotalWorkinghours = shiye.TotalWorkinghours;
|
||||
item.SafeWorkinghours = shiye.SafeWorkinghours;
|
||||
item.LostWorkinghours = shiye.LostWorkinghours;
|
||||
item.TotalEnergyConsumption = shiye.TotalEnergyConsumption;
|
||||
item.IncomeComprehensiveEnergyConsumption = shiye.IncomeComprehensiveEnergyConsumption;
|
||||
item.NewWaterConsumption = shiye.NewWaterConsumption;
|
||||
item.GeneralClosedNum = shiye.GeneralClosedNum;
|
||||
item.GeneralNotClosedNum = shiye.GeneralNotClosedNum;
|
||||
item.MajorClosedNum = shiye.MajorClosedNum;
|
||||
item.MajorNotClosedNum = shiye.MajorNotClosedNum;
|
||||
item.HotWorkPermitNum = shiye.HotWorkPermitNum;
|
||||
item.HotWorkClosedNum = shiye.HotWorkClosedNum;
|
||||
item.HighPermitNum = shiye.HighPermitNum;
|
||||
item.HighClosedNum = shiye.HighPermitNum;
|
||||
item.TemporaryElectricityPermitNum = shiye.TemporaryElectricityPermitNum;
|
||||
item.TemporaryElectricityClosedNum = shiye.TemporaryElectricityClosedNum;
|
||||
item.BlindPlatePermitNum = shiye.BlindPlatePermitNum;
|
||||
item.BlindPlateClosedNum = shiye.BlindPlateClosedNum;
|
||||
item.GroundbreakingPermitNum = shiye.GroundbreakingPermitNum;
|
||||
item.GroundbreakingClosedNum = shiye.GroundbreakingClosedNum;
|
||||
item.OpenCircuitPermitNum = shiye.OpenCircuitPermitNum;
|
||||
item.OpenCircuitClosedNum = shiye.OpenCircuitClosedNum;
|
||||
item.HoistingPermitNum = shiye.HoistingPermitNum;
|
||||
item.HoistingClosedNum = shiye.HoistingClosedNum;
|
||||
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1660,5 +1660,302 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 根据培训类型获取项目培训人员信息
|
||||
/// <summary>
|
||||
/// 根据培训类型获取项目培训人员信息
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID</param>
|
||||
/// <param name="unitIds">培训单位ID</param>
|
||||
/// <param name="departIds">培训岗位ID</param>
|
||||
/// <param name="trainTypeId">培训类型ID</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.PersonItem> getTrainingPersonListByDepartAndTrainTypeId(string unitIds, string departIds, string trainTypeId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
List<string> unitIdList = Funs.GetStrListByStr(unitIds, ',');
|
||||
var getPersons = from x in db.Sys_User
|
||||
where unitIdList.Contains(x.UnitId)
|
||||
|
||||
select new Model.PersonItem
|
||||
{
|
||||
PersonId = x.UserId,
|
||||
PersonName = x.UserName,
|
||||
SexName = x.Sex,
|
||||
IdentityCard = x.IdentityCard,
|
||||
UnitId = x.UnitId,
|
||||
WorkPostId = x.WorkPostId,
|
||||
Telephone = x.Telephone,
|
||||
PhotoUrl = x.PhotoUrl,
|
||||
DepartId = x.DepartId
|
||||
};
|
||||
if (!string.IsNullOrEmpty(departIds))
|
||||
{
|
||||
List<string> departIdList = Funs.GetStrListByStr(departIds, ',');
|
||||
getPersons = getPersons.Where(x => departIdList.Contains(x.DepartId));
|
||||
}
|
||||
foreach (var item in getPersons)
|
||||
{
|
||||
Model.Base_Unit unit = db.Base_Unit.FirstOrDefault(x => x.UnitId == item.UnitId);
|
||||
if (!string.IsNullOrEmpty(item.UnitId))
|
||||
{
|
||||
if (unit != null)
|
||||
{
|
||||
item.UnitCode = unit.UnitCode;
|
||||
item.UnitName = unit.UnitName;
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(item.DepartId))
|
||||
{
|
||||
Model.Base_Depart depart = db.Base_Depart.FirstOrDefault(x => x.DepartId == item.DepartId);
|
||||
if (depart != null)
|
||||
{
|
||||
item.DepartName = depart.DepartName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
|
||||
var getTrainType = db.Base_TrainType.FirstOrDefault(e => e.TrainTypeId == trainTypeId);
|
||||
|
||||
|
||||
|
||||
|
||||
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 getTrainPersonIdList3 = (from x in db.Training_TestRecord
|
||||
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
|
||||
where 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 == null && 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 == null && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId
|
||||
select x).FirstOrDefault();
|
||||
if (getTrainPersonIdList2 == null)
|
||||
{
|
||||
getTrainPersonList.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return getTrainPersonList;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
|
||||
return getPersons.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,24 +24,53 @@ namespace BLL
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = (from x in db.Training_TestPlan
|
||||
where x.ProjectId == projectId && (x.States == states || states == null)
|
||||
orderby x.TestStartTime descending
|
||||
select new Model.TestPlanItem
|
||||
{
|
||||
TestPlanId = x.TestPlanId,
|
||||
TestPlanCode = x.PlanCode,
|
||||
TestPlanName = x.PlanName,
|
||||
ProjectId = x.ProjectId,
|
||||
TestPlanManId = x.PlanManId,
|
||||
TestPlanManName = db.Sys_User.First(y => y.UserId == x.PlanManId).UserName,
|
||||
TestPalce = x.TestPalce,
|
||||
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
|
||||
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
|
||||
States = x.States,
|
||||
QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'),
|
||||
}).ToList();
|
||||
return getDataLists;
|
||||
if (string.IsNullOrEmpty(projectId))
|
||||
{
|
||||
var getDataLists = (from x in db.Training_TestPlan
|
||||
where (x.ProjectId == null || x.ProjectId=="") && (x.States == states || states == null)
|
||||
orderby x.TestStartTime descending
|
||||
select new Model.TestPlanItem
|
||||
{
|
||||
TestPlanId = x.TestPlanId,
|
||||
TestPlanCode = x.PlanCode,
|
||||
TestPlanName = x.PlanName,
|
||||
ProjectId = x.ProjectId,
|
||||
DepartIds = x.DepartIds,
|
||||
DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds),
|
||||
TestPlanManId = x.PlanManId,
|
||||
TestPlanManName = db.Sys_User.First(y => y.UserId == x.PlanManId).UserName,
|
||||
TestPalce = x.TestPalce,
|
||||
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
|
||||
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
|
||||
States = x.States,
|
||||
QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'),
|
||||
}).ToList();
|
||||
return getDataLists;
|
||||
}
|
||||
else
|
||||
{
|
||||
var getDataLists = (from x in db.Training_TestPlan
|
||||
where x.ProjectId == projectId && (x.States == states || states == null)
|
||||
orderby x.TestStartTime descending
|
||||
select new Model.TestPlanItem
|
||||
{
|
||||
TestPlanId = x.TestPlanId,
|
||||
TestPlanCode = x.PlanCode,
|
||||
TestPlanName = x.PlanName,
|
||||
ProjectId = x.ProjectId,
|
||||
TestPlanManId = x.PlanManId,
|
||||
DepartIds = x.DepartIds,
|
||||
DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds),
|
||||
TestPlanManName = db.Sys_User.First(y => y.UserId == x.PlanManId).UserName,
|
||||
TestPalce = x.TestPalce,
|
||||
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
|
||||
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
|
||||
States = x.States,
|
||||
QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'),
|
||||
}).ToList();
|
||||
return getDataLists;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -389,7 +389,7 @@ namespace BLL
|
||||
var getDataLists = (from x in db.Training_TestRecord
|
||||
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
|
||||
join z in db.SitePerson_Person on x.TestManId equals z.PersonId
|
||||
where x.ProjectId == projectId && x.TestStartTime.HasValue && x.TestEndTime.HasValue
|
||||
where ((string.IsNullOrEmpty(projectId) && x.ProjectId == null) || (!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId)) && x.TestStartTime.HasValue && x.TestEndTime.HasValue
|
||||
orderby x.TestStartTime descending
|
||||
select new Model.TestRecordItem
|
||||
{
|
||||
@@ -697,5 +697,73 @@ namespace BLL
|
||||
return newTestRecord.TestRecordId;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static List<Model.TestRecordItem> getTrainingTestRecordListByDepartId(string unitId, string departId, string strPass, string strParam)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = (from x in db.Training_TestRecord
|
||||
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
|
||||
join z in db.Sys_User on x.TestManId equals z.UserId
|
||||
where x.ProjectId == null && x.TestStartTime.HasValue && x.TestEndTime.HasValue
|
||||
orderby x.TestStartTime descending
|
||||
select new Model.TestRecordItem
|
||||
{
|
||||
TestRecordId = x.TestRecordId,
|
||||
ProjectId = x.ProjectId,
|
||||
TestPlanId = x.TestPlanId,
|
||||
TestPlanName = y.PlanName,
|
||||
UnitId = z.UnitId,
|
||||
UnitName = getUnitName(z.UnitId),
|
||||
WorkPostId = z.WorkPostId,
|
||||
WorkPostName = db.Base_WorkPost.FirstOrDefault(p => p.WorkPostId == z.WorkPostId).WorkPostName,
|
||||
DepartId = z.DepartId,
|
||||
TestManId = x.TestManId,
|
||||
TestManName = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == x.TestManId).PersonName,
|
||||
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
|
||||
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
|
||||
Duration = x.Duration,
|
||||
TestPlanEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime.Value.AddMinutes(x.Duration)),
|
||||
TotalScore = y.TotalScore ?? 0,
|
||||
TestScores = x.TestScores ?? 0,
|
||||
TestType = x.TestType,
|
||||
TemporaryUser = x.TemporaryUser,
|
||||
});
|
||||
if (!string.IsNullOrEmpty(unitId))
|
||||
{
|
||||
getDataLists = getDataLists.Where(x => x.UnitId == unitId);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(departId))
|
||||
{
|
||||
getDataLists = getDataLists.Where(x => x.DepartId == departId);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(strParam))
|
||||
{
|
||||
getDataLists = getDataLists.Where(x => x.TestManName.Contains(strParam));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(strPass))
|
||||
{
|
||||
int PassingScore = SysConstSetService.getPassScoreForApi();
|
||||
if (strPass == "0")
|
||||
{
|
||||
getDataLists = getDataLists.Where(x => x.TestScores < PassingScore);
|
||||
}
|
||||
else
|
||||
{
|
||||
getDataLists = getDataLists.Where(x => x.TestScores >= PassingScore);
|
||||
}
|
||||
}
|
||||
foreach (var item in getDataLists)
|
||||
{
|
||||
var depart = db.Base_Depart.FirstOrDefault(x => x.DepartId == item.DepartId);
|
||||
if (depart != null)
|
||||
{
|
||||
item.DepartName = depart.DepartName;
|
||||
}
|
||||
|
||||
}
|
||||
return getDataLists.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,8 @@ namespace BLL
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = (from x in db.EduTrain_TrainRecord
|
||||
where x.ProjectId == projectId && x.TrainTypeId == trainTypeId
|
||||
where ((string.IsNullOrEmpty(projectId) && x.ProjectId == null)
|
||||
|| (!string.IsNullOrEmpty(projectId) && (x.ProjectId == null || x.ProjectId == ""))) && x.TrainTypeId == trainTypeId
|
||||
orderby x.TrainStartDate descending
|
||||
select new Model.TrainRecordItem
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace BLL
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = (from x in db.Training_TrainTestRecord
|
||||
where x.ProjectId == projectId
|
||||
where ((string.IsNullOrEmpty(projectId) && (x.ProjectId == null || x.ProjectId == "")) || (!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId))
|
||||
orderby x.DateA descending
|
||||
select new Model.HSSE.TrainTestRecordItem
|
||||
{
|
||||
|
||||
@@ -21,7 +21,15 @@ namespace BLL
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = (from x in db.Training_Plan
|
||||
where x.ProjectId == projectId && (x.States == states || states == null) && x.TrainTypeId == trainTypeId
|
||||
where
|
||||
(
|
||||
(string.IsNullOrEmpty(projectId) && (x.ProjectId == null || x.ProjectId == ""))
|
||||
||
|
||||
(!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId)
|
||||
)
|
||||
|
||||
&& (x.States == states || states == null)
|
||||
&& x.TrainTypeId == trainTypeId
|
||||
orderby x.TrainStartDate descending
|
||||
select new Model.TrainingPlanItem
|
||||
{
|
||||
@@ -76,14 +84,18 @@ namespace BLL
|
||||
TeachMan = x.TeachMan,
|
||||
UnitIds = x.UnitIds,
|
||||
WorkPostId = x.WorkPostId,
|
||||
DepartIds = x.DepartIds,
|
||||
DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds),
|
||||
TrainContent = x.TrainContent,
|
||||
UnitNames = UnitService.getUnitNamesUnitIds(x.UnitIds),
|
||||
WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(x.WorkPostId),
|
||||
UnitNames = UnitService.getUnitNamesUnitIdsForApi(x.UnitIds),
|
||||
WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIdsForApi(x.WorkPostId),
|
||||
DesignerId = x.DesignerId,
|
||||
DesignerName = db.Sys_User.First(y => y.UserId == x.DesignerId).UserName,
|
||||
DesignerDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.TrainStartDate),
|
||||
States = x.States,
|
||||
QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'),
|
||||
|
||||
TrainingTasks = getTrainingTasks(x.PlanId)
|
||||
};
|
||||
return getDataLists.FirstOrDefault();
|
||||
}
|
||||
@@ -136,7 +148,7 @@ namespace BLL
|
||||
{
|
||||
PlanId = trainingPlan.PlanId,
|
||||
PlanCode = trainingPlan.PlanCode,
|
||||
ProjectId = trainingPlan.ProjectId,
|
||||
|
||||
DesignerId = trainingPlan.DesignerId,
|
||||
PlanName = trainingPlan.PlanName,
|
||||
TrainContent = trainingPlan.TrainContent,
|
||||
@@ -147,9 +159,15 @@ namespace BLL
|
||||
TrainTypeId = trainingPlan.TrainTypeId,
|
||||
UnitIds = trainingPlan.UnitIds,
|
||||
WorkPostId = trainingPlan.WorkPostId,
|
||||
DepartIds = trainingPlan.DepartIds,
|
||||
DepartNames = trainingPlan.DepartNames,
|
||||
States = trainingPlan.States,
|
||||
};
|
||||
if (!string.IsNullOrEmpty(trainingPlan.ProjectId))
|
||||
{
|
||||
newTrainingPlan.ProjectId = trainingPlan.ProjectId;
|
||||
|
||||
}
|
||||
if (!string.IsNullOrEmpty(trainingPlan.TrainLevelId))
|
||||
{
|
||||
newTrainingPlan.TrainLevelId = trainingPlan.TrainLevelId;
|
||||
@@ -200,6 +218,8 @@ namespace BLL
|
||||
isUpdate.UnitIds = newTrainingPlan.UnitIds;
|
||||
isUpdate.WorkPostId = newTrainingPlan.WorkPostId;
|
||||
isUpdate.States = newTrainingPlan.States;
|
||||
isUpdate.DepartIds = newTrainingPlan.DepartIds;
|
||||
isUpdate.DepartNames = newTrainingPlan.DepartNames;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
////删除培训任务
|
||||
@@ -275,6 +295,24 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Model.TrainingTaskItem> getTrainingTasks(string planId) {
|
||||
var list = new List<Model.TrainingTaskItem>();
|
||||
var taskList = Funs.DB.Training_Task.Where(x => x.PlanId == planId);
|
||||
if (taskList.Count()>0)
|
||||
{
|
||||
foreach (var item in taskList)
|
||||
{
|
||||
var model = new Model.TrainingTaskItem();
|
||||
model.TaskId = item.TaskId;
|
||||
model.PlanId = item.PlanId;
|
||||
model.PersonId = item.UserId;
|
||||
model.PersonName = UserService.GetUserNameByUserId(item.UserId);
|
||||
list.Add(model);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增 培训人员明细
|
||||
/// </summary>
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace BLL
|
||||
personId = PersonService.GetPersonIdByUserId(personId);
|
||||
var getDataLists = (from x in db.Training_Task
|
||||
join y in db.Training_Plan on x.PlanId equals y.PlanId
|
||||
where x.ProjectId == projectId && x.UserId == personId && y.States != "0"
|
||||
where ((string.IsNullOrEmpty(projectId) && (x.ProjectId == null || x.ProjectId == "")) || (!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId)) && x.UserId == personId && y.States != "0"
|
||||
orderby x.TaskDate descending
|
||||
select new Model.TrainingTaskItem
|
||||
{
|
||||
@@ -31,17 +31,30 @@ namespace BLL
|
||||
PlanName = y.PlanName,
|
||||
TrainStartDate = string.Format("{0:yyyy-MM-dd HH:mm}", y.TrainStartDate),
|
||||
TeachAddress = y.TeachAddress,
|
||||
//PersonId = x.UserId,
|
||||
PersonId = x.UserId,
|
||||
PersonName = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == x.UserId).PersonName,
|
||||
TaskDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.TaskDate),
|
||||
TrainTypeName = db.Base_TrainType.FirstOrDefault(b => b.TrainTypeId == y.TrainTypeId).TrainTypeName,
|
||||
TrainLevelName = db.Base_TrainLevel.FirstOrDefault(b => b.TrainLevelId == y.TrainLevelId).TrainLevelName,
|
||||
PlanStatesName = y.States == "3" ? "已完成" : "培训中",
|
||||
|
||||
}).ToList();
|
||||
TaskStatesName = x.States == "2" ? "已完成" : "培训中",
|
||||
TrainingItemCode = getTrainingItemCode(y.PlanId)
|
||||
}).ToList();
|
||||
return getDataLists;
|
||||
}
|
||||
}
|
||||
|
||||
public static string getTrainingItemCode(string PlanId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var ids = db.Training_PlanItem.Where(xx => xx.PlanId == PlanId).Select(x => x.CompanyTrainingItemId).ToList();
|
||||
var codes = db.Training_CompanyTrainingItem.Where(x => ids.Contains(x.CompanyTrainingItemId)).Select(x => x.CompanyTrainingItemCode);
|
||||
string res = string.Join(",", codes);
|
||||
return res;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据TaskId获取培训任务教材明细列表
|
||||
@@ -210,10 +223,29 @@ namespace BLL
|
||||
TaskId = x.TaskId,
|
||||
PlanId = x.PlanId,
|
||||
PersonId = x.UserId,
|
||||
PersonName = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == x.UserId).PersonName,
|
||||
|
||||
TaskDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.TaskDate),
|
||||
States = x.States,
|
||||
States = x.States,
|
||||
}).ToList();
|
||||
|
||||
foreach (var item in getDataLists)
|
||||
{
|
||||
var person = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == item.PersonId);
|
||||
if (person != null)
|
||||
{
|
||||
item.PersonName = person.PersonName;
|
||||
}
|
||||
else
|
||||
{
|
||||
var sysUser = db.Sys_User.FirstOrDefault(p => p.UserId == item.PersonId);
|
||||
if (sysUser != null)
|
||||
{
|
||||
item.PersonName = sysUser.UserName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return getDataLists;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user