20220829未做培训计划 新增按钮手动加入培训记录

This commit is contained in:
杨红卫 2022-08-29 19:58:10 +08:00
parent 03b773e8e4
commit 54590920e4
9 changed files with 162 additions and 28 deletions

View File

@ -538,36 +538,40 @@ GO
--GO
/*ÏîÄ¿*/
INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
VALUES('D097252D-B42A-4CAE-9030-A5C351057ABD','Menu_ProjectSet','ÏîÄ¿ÉèÖÃ',1,'MenuType_P')
GO
INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
VALUES('E116D85E-6215-4299-9EEA-FBC46B0E6163','Menu_CQMS','质量管理',2,'MenuType_P')
INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
VALUES('CF2CA03F-84B3-432E-AEAC-4ECF7890D6D7','Menu_PZHGL','施工管理',2,'MenuType_P')
GO
INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
VALUES('35282E20-81AB-4DA2-80F2-8F136776642D','Menu_HSSE','安全管理',3,'MenuType_P')
VALUES('E116D85E-6215-4299-9EEA-FBC46B0E6163','Menu_CQMS','质量管理',3,'MenuType_P')
GO
INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
VALUES('B4F6F0B8-C7AD-421A-9BE3-DCC70EB39A8C','Menu_JDGL','进度管理',4,'MenuType_P')
VALUES('B4F6F0B8-C7AD-421A-9BE3-DCC70EB39A8C','Menu_JDGL','进度/计划',4,'MenuType_P')
GO
INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
VALUES('CE689095-841F-4714-A2B4-BF72D13E2B94','Menu_HJGL','焊接管理',5,'MenuType_P')
VALUES('35282E20-81AB-4DA2-80F2-8F136776642D','Menu_HSSE','HSE管理',5,'MenuType_P')
GO
INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
VALUES('CE689095-841F-4714-A2B4-BF72D13E2B94','Menu_HJGL','焊接管理',6,'MenuType_P')
GO
INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
VALUES('7AD04F82-91B3-4579-993C-8C8FAC503864','Menu_TestRun','试车管理',6,'MenuType_P')
GO
INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
VALUES('CF2CA03F-84B3-432E-AEAC-4ECF7890D6D7','Menu_PZHGL','施工综合',7,'MenuType_P')
VALUES('7AD04F82-91B3-4579-993C-8C8FAC503864','Menu_TestRun','试车管理',7,'MenuType_P')
GO
INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
VALUES('85CF0BBF-A3F3-42DF-89DC-CE9A4886BCA1','Menu_DigitalSite','视频监控',8,'MenuType_P')
VALUES('126FB0AC-521C-4145-86FC-B507D83B7646','Menu_Change','变更管理',8,'MenuType_P')
GO
INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
VALUES('C0457DFF-AAA3-4019-AC9B-34BF22BF3A0E','Menu_DocControl','文控管理',9,'MenuType_P')
GO
INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
VALUES('0B13D4A9-E047-4C18-AD68-8D3724D4F0A8','Menu_Attendance','现场考勤',10,'MenuType_P')
GO
INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
VALUES('85CF0BBF-A3F3-42DF-89DC-CE9A4886BCA1','Menu_Video','视频监控',11,'MenuType_P')
GO
--INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
--VALUES('0B13D4A9-E047-4C18-AD68-8D3724D4F0A8','Menu_Video','现场考勤',9,'MenuType_P')
--GO
--INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId)
--VALUES('69B856E6-E385-4771-9341-23E7416C46F1','Menu_PDigData','项目考勤',9,'MenuType_P')
--GO
--ÏîÄ¿ÀàÐÍ
INSERT INTO dbo.Sys_Const(ID, ConstValue, ConstText, SortIndex, GroupId)

View File

@ -0,0 +1,4 @@
ALTER TABLE [dbo].[EduTrain_TrainRecord] DROP CONSTRAINT [FK_EduTrain_TrainRecord_Training_Plan]
GO

View File

@ -0,0 +1,3 @@
--ADD BY YangHongwei 2022-08-29
1、旭科项目张英魁处理未做培训计划直接按照考试计划考试的情况新增按钮手动将这部分考试记录归到到培训记录中。
--END

View File

@ -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
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}
}

View File

@ -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;">

View File

@ -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)
{