This commit is contained in:
2026-05-13 13:08:37 +08:00
parent 06da5bb0d2
commit 7aa249231e

View File

@@ -242,6 +242,8 @@ public class GainfoUpdateService : IGainfoUpdateService
PERNR = item.PERNR,
gname = item.gname,
gname2 = item.gname2,
idno = item.idno,
birthday = item.birthday,
phone = item.phone,
appellation = item.appellation,
isowner = item.isowner,
@@ -300,6 +302,9 @@ public class GainfoUpdateService : IGainfoUpdateService
{
InternalNo = item.PERNR,
Name = item.gname,
NameEn = item.gname2,
IdNo = item.idno.ToUpperInvariant(),
Birthday = item.birthday,
PositionNo = item.STELL,
Grade = item.ZZ_ZD,
Title = item.Z_ZJ,
@@ -452,8 +457,15 @@ public class GainfoUpdateService : IGainfoUpdateService
return new List<SapPersonItem>();
}
var currentPersons = sapList
.OrderByDescending(x => x.ZSTATUS)
.ThenBy(x => x.ZRZRQ)
.GroupBy(x => x.ZWORKCODE)
.Select(x => x.First())
.ToList();
var comparer = new SapPersonComparer();
var workCodes = sapList
var workCodes = currentPersons
.Select(x => x.ZWORKCODE)
.Where(x => !string.IsNullOrWhiteSpace(x))
.Distinct()
@@ -461,22 +473,24 @@ public class GainfoUpdateService : IGainfoUpdateService
if (workCodes.Count <= 0)
{
return sapList;
return currentPersons;
}
var last = await LoadDataAsync(workCodes);
if (last.Count <= 0)
{
return sapList;
return currentPersons;
}
var lastMap = last
.OrderByDescending(x => x.ZSTATUS)
.ThenBy(x => x.ZRZRQ)
.Where(x => !string.IsNullOrWhiteSpace(x.ZWORKCODE))
.GroupBy(x => x.ZWORKCODE)
.ToDictionary(x => x.Key, x => x.First());
var modifiedPersons = new List<SapPersonItem>();
foreach (var person in sapList)
foreach (var person in currentPersons)
{
if (string.IsNullOrWhiteSpace(person.ZWORKCODE))
{