diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/SapBusinessTripService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/SapBusinessTripService.cs index a89f549d..75084bc2 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/SapBusinessTripService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/SapBusinessTripService.cs @@ -34,7 +34,7 @@ public class SapBusinessTripService : ISapBusinessTripService /// public async Task HandlerBusinessTripsByFactoryAsync(string factory) { - var today = DateTime.Today; + var today =DateTime.Today; var yesterday = today.AddDays(-1); try @@ -64,6 +64,7 @@ public class SapBusinessTripService : ISapBusinessTripService var tripInfos = await _dbContext.Queryable() .Where(x => SqlFunc.DateIsSame(x.BeginDate, today) || SqlFunc.DateIsSame(x.BeginDate, yesterday)) .Where(x => !SqlFunc.IsNullOrEmpty(x.Destination)) + .Where(x => !SqlFunc.IsNullOrEmpty(x.BeginDateTime) && !SqlFunc.IsNullOrEmpty(x.EndDateTime)) .Where(x => x.Destination == factory) .ToListAsync(); @@ -72,9 +73,14 @@ public class SapBusinessTripService : ISapBusinessTripService .Where(x => x.Type == DeviceTypeEnumType.Door) .Where(x => x.TenantId == factory) .Where(x => x.IsBusinessTrip) + .Where(x => x.IsDeleted == false) .SingleAsync(); - var deviceCodes = await _dbContext.Queryable().Where(x => x.GroupCode == tripGroup.Code).Select(x => x.DeviceCode).ToListAsync(); + var deviceCodes = await _dbContext.Queryable() + .Where(x => x.GroupCode == tripGroup.Code) + .Where(x => x.IsDeleted == false) + .Select(x => x.DeviceCode) + .ToListAsync(); if (deviceCodes.Any()) {