20220829未做培训计划 新增按钮手动加入培训记录
This commit is contained in:
@@ -184,5 +184,96 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 将相关未做培训 但考试考生内容 写培训记录归档
|
||||
/// <summary>
|
||||
/// 将相关未做培训 但考试考生内容 写培训记录归档
|
||||
/// </summary>
|
||||
/// <param name="getTestPlan"></param>
|
||||
|
||||
public static void InsertTrainRecordNoTrainingPlan(Model.Training_TestPlan getTestPlan)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.EduTrain_TrainRecord newTrainRecord = new Model.EduTrain_TrainRecord
|
||||
{
|
||||
TrainingId = SQLHelper.GetNewID(),
|
||||
TrainingCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectTrainRecordMenuId, getTestPlan.ProjectId, Const.UnitId_CWCEC),
|
||||
ProjectId = getTestPlan.ProjectId,
|
||||
TrainTitle = getTestPlan.PlanName,
|
||||
TrainContent = getTestPlan.PlanName,
|
||||
TrainStartDate = getTestPlan.TestStartTime,
|
||||
TeachHour = getTestPlan.Duration,
|
||||
TrainEndDate = getTestPlan.TestEndTime,
|
||||
TeachMan = UserService.GetUserNameByUserId(getTestPlan.PlanManId),
|
||||
TeachAddress = getTestPlan.TestPalce,
|
||||
Remark = "来源:考试计划",
|
||||
TrainTypeId = Const.EntryTrainTypeId,
|
||||
UnitIds = getTestPlan.UnitIds,
|
||||
States = Const.State_2,
|
||||
WorkPostIds = getTestPlan.WorkPostIds,
|
||||
PlanId = getTestPlan.TestPlanId,
|
||||
};
|
||||
newTrainRecord.CompileMan = newTrainRecord.TeachMan;
|
||||
///获取培训人员
|
||||
var getTestRecords = from x in db.Training_TestRecord
|
||||
where x.TestPlanId == getTestPlan.TestPlanId
|
||||
select x;
|
||||
newTrainRecord.TrainPersonNum = getTestRecords.Count();
|
||||
///新增培训记录
|
||||
db.EduTrain_TrainRecord.InsertOnSubmit(newTrainRecord);
|
||||
db.SubmitChanges();
|
||||
|
||||
////及格分数
|
||||
int passScore = 80;
|
||||
var testRule = db.Sys_TestRule.FirstOrDefault();
|
||||
if (testRule != null)
|
||||
{
|
||||
passScore = testRule.PassingScore;
|
||||
}
|
||||
|
||||
foreach (var item in getTestRecords)
|
||||
{
|
||||
var getItem = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.PersonId == item.TestManId && x.CheckResult);
|
||||
if (getItem == null)
|
||||
{
|
||||
|
||||
decimal gScores = item.TestScores ?? 0;
|
||||
bool result = false;
|
||||
if (gScores >= passScore)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
Model.EduTrain_TrainRecordDetail newDetail = new Model.EduTrain_TrainRecordDetail
|
||||
{
|
||||
TrainDetailId = SQLHelper.GetNewID(),
|
||||
TrainingId = newTrainRecord.TrainingId,
|
||||
PersonId = item.TestManId,
|
||||
CheckScore = gScores,
|
||||
CheckResult = result,
|
||||
};
|
||||
db.EduTrain_TrainRecordDetail.InsertOnSubmit(newDetail);
|
||||
db.SubmitChanges();
|
||||
|
||||
///// 培训考试 通过 更新卡号
|
||||
if (result)
|
||||
{
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == newDetail.PersonId);
|
||||
if (getPerson != null && string.IsNullOrEmpty(getPerson.CardNo))
|
||||
{
|
||||
getPerson.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", getPerson.ProjectId, UnitService.GetUnitCodeByUnitId(getPerson.UnitId));
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////增加一条编码记录
|
||||
CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTrainRecordMenuId, newTrainRecord.ProjectId, null, newTrainRecord.TrainingId, newTrainRecord.TrainStartDate);
|
||||
CommonService.btnSaveData(newTrainRecord.ProjectId, Const.ProjectTrainRecordMenuId, newTrainRecord.TrainingId, getTestPlan.PlanManId, true, newTrainRecord.TrainTitle, "../EduTrain/TrainRecordView.aspx?TrainingId={0}");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static Model.Training_TestPlan GetTestPlanByPlanId(string planId)
|
||||
{
|
||||
return Funs.DB.Training_TestPlan.FirstOrDefault(x => x.PlanId == planId);
|
||||
return Funs.DB.Training_TestPlan.FirstOrDefault(x => x.PlanId == planId || x.TestPlanId ==planId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BLL;
|
||||
using FineUIPro.Web.BoSheng;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -548,7 +549,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
{
|
||||
var getTrainRecordDetail = Funs.DB.EduTrain_TrainRecordDetail.Where(x => x.TrainingId == itemRecord.TrainingId);
|
||||
if (itemRecord.TrainPersonNum > getTrainRecordDetail.Count())
|
||||
{
|
||||
{
|
||||
var getTrainingTasks = from x in Funs.DB.Training_Task
|
||||
where x.PlanId == itemRecord.PlanId
|
||||
select x;
|
||||
@@ -628,14 +629,36 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
Alert.ShowInTop("刷新完成!", MessageBoxIcon.Success);
|
||||
}
|
||||
|
||||
var getTestPlanStates = from x in Funs.DB.Training_TestPlan
|
||||
join y in Funs.DB.Training_Plan on x.PlanId equals y.PlanId
|
||||
where x.States == Const.State_3 && y.States == Const.State_2
|
||||
select x;
|
||||
foreach (var item in getTestPlanStates)
|
||||
var getTestPlans = from x in Funs.DB.Training_TestPlan
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3
|
||||
select x;
|
||||
|
||||
var getTestPlanStates = from x in getTestPlans
|
||||
join y in Funs.DB.Training_Plan on x.PlanId equals y.PlanId
|
||||
where x.PlanId != null && y.States == Const.State_2
|
||||
select x;
|
||||
if (getTestPlanStates.Count() > 0)
|
||||
{
|
||||
////TODO 讲培训计划 考试记录 写入到培训记录
|
||||
BLL. APITrainRecordService.InsertTrainRecord(item);
|
||||
foreach (var item in getTestPlanStates)
|
||||
{
|
||||
////TODO 讲培训计划 考试记录 写入到培训记录
|
||||
BLL.APITrainRecordService.InsertTrainRecord(item);
|
||||
}
|
||||
}
|
||||
|
||||
var getTestPlanS = from x in getTestPlans
|
||||
join y in Funs.DB.EduTrain_TrainRecord on x.TestPlanId equals y.PlanId into jonPerson
|
||||
from y in jonPerson.DefaultIfEmpty()
|
||||
where x.PlanId == null && y.TrainingId == null
|
||||
orderby y.TrainStartDate
|
||||
select x;
|
||||
if (getTestPlanS.Count() > 0)
|
||||
{
|
||||
foreach (var item in getTestPlanS)
|
||||
{
|
||||
//// 将相关未做培训 但考试考生内容 写培训记录归档
|
||||
BLL.APITrainRecordService.InsertTrainRecordNoTrainingPlan(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,11 +140,11 @@
|
||||
</div>
|
||||
<div class="bi-flex-vertical-center-adapt-layout bi-flex-horizontal-layout v-middle h-left"
|
||||
style="height: 100%; position: relative; float: right;">
|
||||
<div
|
||||
<%-- <div
|
||||
class="bi-single bi-basic-button cursor-pointer bi-button button-common bi-label bi-flex-center-adapt-layout clear"
|
||||
style="height: 16px; line-height: 16px; position: relative; flex-shrink: 0; color:#fff">
|
||||
忘记密码?
|
||||
</div>
|
||||
</div>--%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bi-horizon-auto-layout" style="position: relative;">
|
||||
|
||||
@@ -298,7 +298,16 @@ namespace WebAPI.Controllers
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
APITestRecordService.getTestRecordItemAnswerBySelectedItem(testRecordItemId, selectedItem);
|
||||
if (!string.IsNullOrEmpty(testRecordItemId) && !string.IsNullOrEmpty(selectedItem))
|
||||
{
|
||||
APITestRecordService.getTestRecordItemAnswerBySelectedItem(testRecordItemId, selectedItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "答题为空选项!";
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user