This commit is contained in:
geh 2025-05-09 16:34:49 +08:00
parent 7a81d04d48
commit 09373c4a0e
3 changed files with 132 additions and 37 deletions

View File

@ -739,6 +739,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
PersonService.UpdatePerson(person);
}
}
this.BindGrid();
ShowNotify("操作完成!", MessageBoxIcon.Success);
}
#endregion
@ -822,27 +823,27 @@ namespace FineUIPro.Web.HSSE.SitePerson
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(电工).doc";
}
else if (person.WorkPostName == "电焊工")
else if (person.WorkPostName.Contains("电焊工"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(电焊工).doc";
}
else if (person.WorkPostName == "防水普工")
else if (person.WorkPostName.Contains("防水普工"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(防水普工).doc";
}
else if (person.WorkPostName == "钢筋工")
else if (person.WorkPostName.Contains("钢筋工"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(钢筋工).doc";
}
else if (person.WorkPostName == "管理人员")
else if (person.WorkPostName.Contains("管理人员"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(管理人员).doc";
}
else if (person.WorkPostName == "架子工")
else if (person.WorkPostName.Contains("架子工"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(架子工).doc";
}
else if (person.WorkPostName == "木工")
else if (person.WorkPostName.Contains("木工"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(木工).doc";
}
@ -850,43 +851,43 @@ namespace FineUIPro.Web.HSSE.SitePerson
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(普工).doc";
}
else if (person.WorkPostName == "施工电梯司机")
else if (person.WorkPostName.Contains("施工电梯司机"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(施工电梯司机).doc";
}
else if (person.WorkPostName == "水电工")
else if (person.WorkPostName.Contains("水电工"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(水电工).doc";
}
else if (person.WorkPostName == "司索信号工")
else if (person.WorkPostName.Contains("司索信号工"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(司索信号工).doc";
}
else if (person.WorkPostName == "塔吊司机")
else if (person.WorkPostName.Contains("塔吊司机"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(塔吊司机).doc";
}
else if (person.WorkPostName == "挖机司机")
else if (person.WorkPostName.Contains("挖掘机司机"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(挖机司机).doc";
}
else if (person.WorkPostName == "瓦工")
else if (person.WorkPostName.Contains("瓦工"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(瓦工).doc";
}
else if (person.WorkPostName == "渣土车司机")
else if (person.WorkPostName.Contains("渣土车司机"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(渣土车司机).doc";
}
else if (person.WorkPostName == "桩基")
else if (person.WorkPostName.Contains("桩基工"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(桩基).doc";
}
else if (person.WorkPostName == "装配、灌浆工")
else if (person.WorkPostName.Contains("装配灌浆工"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(装配、灌浆工).doc";
}
else if (person.WorkPostName == "班组管理员")
else if (person.WorkPostName.Contains("班组管理员"))
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(班组管理员).doc";
}
@ -906,8 +907,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
File.Copy(uploadfilepath, newUrl);
AsposeWordHelper helper = new AsposeWordHelper();
helper.OpenTempelte(newUrl); //打开模板文件
string projectName = Funs.DB.Base_Project.First(z => z.ProjectId == person.ProjectId).ProjectName;
string projectName = Funs.DB.Base_Project.First(z => z.ProjectId == this.CurrUser.LoginProjectId).ProjectName;
string name = person.PersonName;
string time = DateTime.Now.ToString("yyyy-MM-dd");
string sex = string.IsNullOrEmpty(person.Sex) ? "" : person.Sex == "1" ? "男" : "女";
@ -939,7 +939,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
from TestPlan in gTestPlan.DefaultIfEmpty()
join user in Funs.DB.Sys_User on TestPlan.PlanManId equals user.UserId into gUser
from user in gUser.DefaultIfEmpty()
where x.TestManId == person.PersonId
where x.TestManId == person.PersonId && x.TestScores >= 70 && x.ProjectId == CurrUser.LoginProjectId
orderby x.TestEndTime descending
select new
{

View File

@ -445,15 +445,30 @@ namespace WebAPI.Controllers
var person = Funs.DB.View_SitePerson_Person.FirstOrDefault(x => x.PersonId == personId);
if (person != null)
{
Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord
string testRecordId = string.Empty;
Model.Training_TestRecord testRecord = Funs.DB.Training_TestRecord
.Where(e => e.ProjectId == projectId && e.TestManId == personId && e.TestScores == null)
.OrderByDescending(e => e.TestStartTime)
.FirstOrDefault();
if (testRecord != null)
{
TestRecordId = SQLHelper.GetNewID(),
ProjectId = projectId,
TestManId = person.PersonId
};
TestRecordService.AddTestRecord(newTestRecord);
testRecordId = testRecord.TestRecordId;
}
else
{
Model.SUBQHSEDB db = Funs.DB;
Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord
{
TestRecordId = SQLHelper.GetNewID(),
ProjectId = projectId,
TestManId = personId,
Duration = 60,
};
db.Training_TestRecord.InsertOnSubmit(newTestRecord);
db.SubmitChanges();
testRecordId = CreateTestRecordItemNew(newTestRecord.TestRecordId, person);
}
var testRecordId = CreateTestRecordItemNew(newTestRecord.TestRecordId, person);
responeData.code = 1;
responeData.data = new { testRecordId };
}
@ -473,7 +488,8 @@ namespace WebAPI.Controllers
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var getTestTrainingItemList = (from x in Funs.DB.Training_TestTrainingItem
where x.TrainingId == "99ccf4c8-6f8e-47da-a900-53b12a278f25" &&
join y in Funs.DB.Training_TestTraining on x.TrainingId equals y.TrainingId
where y.TrainingName.Contains("岗位人员试题") &&
x.WorkPostNames.Contains(person.WorkPostName)
orderby x.TestType, x.TrainingItemCode
select new

View File

@ -691,22 +691,42 @@ namespace WebAPI.Controllers
int getPassScores = 70;
if (getTestScores < getPassScores)
{
int testCount = db.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count();
if (testCount < 2)
// int testCount = db.Training_TestRecord.Where(x => x.ProjectId == getTestRecord.ProjectId && x.TestManId == getTestRecord.TestManId).Count();
// if (testCount < 2)
// {
////重新生成一条考试记录 以及考试试卷
// returnTestRecordId = APITestRecordService.getResitTestRecord(getTestRecord);
Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord
{
////重新生成一条考试记录 以及考试试卷
returnTestRecordId = APITestRecordService.getResitTestRecord(getTestRecord);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,您将进入补考。";
}
else
TestRecordId = SQLHelper.GetNewID(),
ProjectId = getTestRecord.ProjectId,
TestManId = getTestRecord.TestManId,
TestType = getTestRecord.TestType,
TemporaryUser = getTestRecord.TemporaryUser,
Duration = getTestRecord.Duration,
};
Funs.DB.Training_TestRecord.InsertOnSubmit(newTestRecord);
Funs.DB.SubmitChanges();
var person =
Funs.DB.View_SitePerson_Person.FirstOrDefault(
x => x.PersonId == newTestRecord.TestManId);
if (person != null)
{
// APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。";
CreateTestRecordItemNew(newTestRecord.TestRecordId, person);
}
returnTestRecordId = newTestRecord.TestRecordId;
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,您将进入补考。";
// }
// else
// {
// responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。";
// }
}
else
{
// APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。";
}
@ -723,6 +743,65 @@ namespace WebAPI.Controllers
return responeData;
}
public static string CreateTestRecordItemNew(string testRecordId, Model.View_SitePerson_Person person)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var getTestTrainingItemList = (from x in Funs.DB.Training_TestTrainingItem
join y in Funs.DB.Training_TestTraining on x.TrainingId equals y.TrainingId
where y.TrainingName.Contains("岗位人员试题") &&
x.WorkPostIds.Contains(person.WorkPostId)
orderby x.TestType, x.TrainingItemCode
select new
{
x.TrainingItemId,
x.TrainingId,
x.TrainingItemName,
x.TrainingItemCode,
x.Abstracts,
x.AttachUrl,
x.TestType,
x.WorkPostIds,
x.WorkPostNames,
x.AItem,
x.BItem,
x.CItem,
x.DItem,
x.EItem,
x.AnswerItems,
x.Score
}).ToList();
if (getTestTrainingItemList.Count() > 0)
{
var getItems = from x in getTestTrainingItemList
select new Model.Training_TestRecordItem
{
TestRecordItemId = SQLHelper.GetNewID(),
TestRecordId = testRecordId,
TrainingItemName = x.TrainingItemName,
TrainingItemCode = x.TrainingItemCode,
Abstracts = x.Abstracts,
AttachUrl = x.AttachUrl,
TestType = x.TestType,
AItem = x.AItem,
BItem = x.BItem,
CItem = x.CItem,
DItem = x.DItem,
EItem = x.EItem,
AnswerItems = x.AnswerItems,
Score = x.Score,
};
db.Training_TestRecordItem.InsertAllOnSubmit(getItems);
db.SubmitChanges();
}
return testRecordId;
}
}
#endregion