fix 修改设备对应营业点

This commit is contained in:
cheche
2024-03-05 15:45:21 +08:00
parent ec54d9ddbb
commit 3de3fde888
8 changed files with 85 additions and 4 deletions

View File

@@ -37,7 +37,6 @@ public class DeviceService : IDeviceService
FuncsStr = d.Funcs.ToString(),
Brand = dt.Brand,
Type = d.Type,
}, true)
.ToPageListAsync(request);
@@ -59,6 +58,37 @@ public class DeviceService : IDeviceService
})
.ToListAsync();
var Registries = await _dbContext.Queryable<DeviceRegistryEntity>()
.ToListAsync();
var BusinessPlaces = await _dbContext.Queryable<BusinessPlaceEntity>()
.ToListAsync();
foreach (var res in page.Data)
{
var list = new List<PlaceCodeNameDetil>();
var regis = Registries.Where(x => x.DeviceUniqueNo == res.UniqueNo).ToList();
if (regis!=null && regis.Count>0)
{
foreach (var re in regis)
{
var place = BusinessPlaces.Where(x => x.Code == re.BusinessPlaceCode)
.FirstOrDefault();
if (place != null)
{
var detil = new PlaceCodeNameDetil
{
BusinessPlaceCode = re.BusinessPlaceCode.ToString(),
BusinessPlaceName = place.Name
};
list.Add(detil);
}
}
}
res.detils = list;
}
page.Data.ForEach(device =>
{
device.Amount = balanceRecords.Sum(x => x.Amount);
@@ -332,7 +362,7 @@ public class DeviceService : IDeviceService
{
var page = await _dbContext.Queryable<DeviceEntity>()
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
.Where(d => d.Type == DeviceTypeEnumType.Attendance && d.Enable)
.Where(x => x.Type == DeviceTypeEnumType.Attendance || (x.Type == DeviceTypeEnumType.Door && x.AsAttendance))
.Select((d, dt) => new DevicePageResponse
{
FuncsStr = d.Funcs.ToString(),