diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs index a2ee10d8..ff54b58d 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs @@ -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(); } + 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(); - foreach (var person in sapList) + foreach (var person in currentPersons) { if (string.IsNullOrWhiteSpace(person.ZWORKCODE)) {