安全培训教育统计报表 去除 按人员生产单元 添加多条数据

This commit is contained in:
wyw 2026-04-10 16:42:40 +08:00
parent e628bdc3d6
commit bf5fbf1ac7

View File

@ -423,50 +423,50 @@ namespace APT.PP.WebApi.Controllers.Api.PP
List<T_SE_TRAIN_RECORD_REPORT> recordLists = new List<T_SE_TRAIN_RECORD_REPORT>(); List<T_SE_TRAIN_RECORD_REPORT> recordLists = new List<T_SE_TRAIN_RECORD_REPORT>();
foreach (var item in trainRecords) foreach (var item in trainRecords)
{ {
if (item.Nav_User.Nav_ProdutionUnit != null) //if (item.Nav_User.Nav_ProdutionUnit != null)
{ //{
foreach (var dep in item.Nav_User.Nav_ProdutionUnit) // foreach (var dep in item.Nav_User.Nav_ProdutionUnit)
{ // {
T_SE_TRAIN_RECORD_REPORT newRecord = new T_SE_TRAIN_RECORD_REPORT(); // T_SE_TRAIN_RECORD_REPORT newRecord = new T_SE_TRAIN_RECORD_REPORT();
newRecord.NAME = item.Nav_User.NAME; // newRecord.NAME = item.Nav_User.NAME;
newRecord.CODE = item.Nav_User.CODE; // newRecord.CODE = item.Nav_User.CODE;
newRecord.LEVEL = item.Nav_Record.Nav_Notify.LEVEL.GetDescription(); // newRecord.LEVEL = item.Nav_Record.Nav_Notify.LEVEL.GetDescription();
newRecord.DEPARTMENT_NAME = item.Nav_User.Nav_Department.NAME; // newRecord.DEPARTMENT_NAME = item.Nav_User.Nav_Department.NAME;
newRecord.UNIT = dep.Nav_Enums.NAME; // newRecord.UNIT = dep.Nav_Enums.NAME;
newRecord.CLASS_NAME = item.Nav_Record.Nav_Notify.NAME; // newRecord.CLASS_NAME = item.Nav_Record.Nav_Notify.NAME;
newRecord.START_TIME = (DateTime)item.Nav_Record.Nav_Notify.TRAIN_START_TIME; // newRecord.START_TIME = (DateTime)item.Nav_Record.Nav_Notify.TRAIN_START_TIME;
newRecord.END_TIME = (DateTime)item.Nav_Record.Nav_Notify.TRAIN_END_TIME; // newRecord.END_TIME = (DateTime)item.Nav_Record.Nav_Notify.TRAIN_END_TIME;
//newRecord.TRAIN_TYPE = changeEnum(item.Nav_Record.Nav_Notify.TRAIN_MODEL); // //newRecord.TRAIN_TYPE = changeEnum(item.Nav_Record.Nav_Notify.TRAIN_MODEL);
//newRecord.TRAIN_MODEL = item.Nav_Record.Nav_Notify.Nav_TrainCheckType.NAME; // //newRecord.TRAIN_MODEL = item.Nav_Record.Nav_Notify.Nav_TrainCheckType.NAME;
try // try
{ // {
newRecord.TRAIN_TYPE = item.Nav_Record.Nav_Notify.TRAINTYPE.GetDescription(); // newRecord.TRAIN_TYPE = item.Nav_Record.Nav_Notify.TRAINTYPE.GetDescription();
newRecord.TRAIN_MODEL = item.Nav_Record.Nav_Notify.CHECKTYPE.GetDescription(); // newRecord.TRAIN_MODEL = item.Nav_Record.Nav_Notify.CHECKTYPE.GetDescription();
} // }
catch { } // catch { }
newRecord.TRAIN_HOUR = item.Nav_Record.Nav_Notify.HOURS; // newRecord.TRAIN_HOUR = item.Nav_Record.Nav_Notify.HOURS;
newRecord.ORG_ID = filter.GetOrgId(); // newRecord.ORG_ID = filter.GetOrgId();
newRecord.RECORD_ID = item.RECORD_ID; // newRecord.RECORD_ID = item.RECORD_ID;
newRecord.TRAIN_TEACHER = item.Nav_Record.Nav_Notify.TRAIN_TEACHER; // newRecord.TRAIN_TEACHER = item.Nav_Record.Nav_Notify.TRAIN_TEACHER;
newRecord.USER_ID = item.USER_ID; // newRecord.USER_ID = item.USER_ID;
newRecord.NOTIFY_ID = item.Nav_Record.NOTIFY_ID; // newRecord.NOTIFY_ID = item.Nav_Record.NOTIFY_ID;
var papers = item.Nav_Record.Nav_Papers.FirstOrDefault(t => t.USER_ID == item.USER_ID); // var papers = item.Nav_Record.Nav_Papers.FirstOrDefault(t => t.USER_ID == item.USER_ID);
if (papers != null) // if (papers != null)
{ // {
newRecord.TRAIN_SCORE = item.Nav_Record.Nav_Papers.FirstOrDefault(t => t.USER_ID == item.USER_ID).SCORE; // newRecord.TRAIN_SCORE = item.Nav_Record.Nav_Papers.FirstOrDefault(t => t.USER_ID == item.USER_ID).SCORE;
} // }
var score = item.Nav_Record.Nav_Papers.FirstOrDefault(t => t.USER_ID == item.ID); // var score = item.Nav_Record.Nav_Papers.FirstOrDefault(t => t.USER_ID == item.ID);
if (score != null) // if (score != null)
{ // {
newRecord.TRAIN_SCORE = score.SCORE; // newRecord.TRAIN_SCORE = score.SCORE;
} // }
recordLists.Add(newRecord); // recordLists.Add(newRecord);
} // }
} //}
else //else
{ //{
T_SE_TRAIN_RECORD_REPORT newRecord = new T_SE_TRAIN_RECORD_REPORT(); T_SE_TRAIN_RECORD_REPORT newRecord = new T_SE_TRAIN_RECORD_REPORT();
newRecord.NAME = item.Nav_User.NAME; newRecord.NAME = item.Nav_User.NAME;
newRecord.CODE = item.Nav_User.CODE; newRecord.CODE = item.Nav_User.CODE;
@ -495,7 +495,7 @@ namespace APT.PP.WebApi.Controllers.Api.PP
newRecord.TRAIN_SCORE = score.SCORE; newRecord.TRAIN_SCORE = score.SCORE;
} }
recordLists.Add(newRecord); recordLists.Add(newRecord);
} //}
} }
UnifiedCommit(() => UnifiedCommit(() =>