diff --git a/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs b/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs index 4fa23cbf..7924d9bd 100644 --- a/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs +++ b/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs @@ -237,7 +237,10 @@ public class GainfoUpdateService : IGainfoUpdateService } else { - await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync(); + if (!await _dbContext.Queryable().AnyAsync(x => x.Code == item.ename)) + { + await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync(); + } return null; } } @@ -371,7 +374,10 @@ public class GainfoUpdateService : IGainfoUpdateService else { var info = GainfoSapToGainfo(item); - await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync(); + if (!await _dbContext.Queryable().AnyAsync(x => x.Code == item.ename)) + { + await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync(); + } } }