Commit 14b96f7c by ruyun.zhang

考勤上报继承时更新人员字典

parent 9006f2d6
......@@ -37,6 +37,7 @@ public class PersonService : IAutoInjection
private readonly PerforHospitalRepository perforHospitalRepository;
private readonly PerforCofaccountingRepository perforCofaccountingRepository;
private readonly PerforPerAttendanceIssueRepository _issueRepository;
private readonly PerforPerAttendanceDeptReportRepository _deptReportRepository;
private readonly UserService userService;
private readonly DapperService dapperService;
private readonly Application application;
......@@ -56,6 +57,7 @@ public class PersonService : IAutoInjection
PerforHospitalRepository perforHospitalRepository,
PerforCofaccountingRepository perforCofaccountingRepository,
PerforPerAttendanceIssueRepository issueRepository,
PerforPerAttendanceDeptReportRepository deptReportRepository,
UserService userService,
DapperService dapperService,
IOptions<Application> application,
......@@ -74,6 +76,7 @@ public class PersonService : IAutoInjection
this.perforHospitalRepository = perforHospitalRepository;
this.perforCofaccountingRepository = perforCofaccountingRepository;
_issueRepository = issueRepository;
_deptReportRepository = deptReportRepository;
this.userService = userService;
this.dapperService = dapperService;
this.application = application.Value;
......@@ -171,6 +174,24 @@ public void CreateAllotPersons(int hospitalId, int allotId, int prevAllotId = -1
}
}
}
// lcr 2023-05-10 按考勤上报记录最后一次所在科室更新人员字典
var deptRepors = _deptReportRepository.GetEntities(w => w.AllotId == prevAllotId);
if (deptRepors?.Any() == true)
{
foreach (var item in data)
{
var personnel = deptRepors.Where(w => w.PersonnelNumber == item.PersonnelNumber).OrderByDescending(w => w.BeginDate).FirstOrDefault();
if (personnel != null)
{
if (personnel.UnitType != item.UnitType || personnel.AccountingUnit != item.AccountingUnit || personnel.PermanentStaff != item.PermanentStaff)
{
item.UnitType = personnel.UnitType;
item.AccountingUnit = personnel.AccountingUnit;
item.PermanentStaff = personnel.PermanentStaff;
}
}
}
}
SaveAllotPersons(data);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment