fix 修改设备对应营业点
This commit is contained in:
@@ -93,4 +93,14 @@ public class BusinessPlacesController : ControllerBase
|
||||
{
|
||||
return await _businessPlaceShiftService.GetShiftsByPlaceCustomCodeAsync(request.CustomCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据营业点获取下面的设备
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task GetDevicesByCode(BusinessPlaceGetByCodeRequest request)
|
||||
{
|
||||
return await _businessPlaceShiftService.GetDevicesByCode(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Request
|
||||
{
|
||||
public class BusinessPlaceGetByCodeRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 营业点号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "营业点号不能为空")]
|
||||
public string Code { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Dlhis.Basic.BusinessPlace.Response
|
||||
{
|
||||
public class DeviceCodeNameDetail
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
@@ -16,4 +17,6 @@ public interface IBusinessPlaceShiftService : IScopeDependency
|
||||
Task SaveMealShiftsAsync(List<BusinessPlaceShiftSaveMealShiftRequest> requests);
|
||||
|
||||
Task<BusinessPlaceWithShiftResponse> GetShiftsByPlaceCustomCodeAsync(string placeCustomCode);
|
||||
|
||||
Task GetDevicesByCode(BusinessPlaceGetByCodeRequest request);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
@@ -188,6 +189,10 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<List<>> GetDevicesByCode(BusinessPlaceGetByCodeRequest request)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//*********************************************** help methods ***************************************************//
|
||||
|
||||
|
||||
@@ -99,4 +99,9 @@ public class DevicePageResponse
|
||||
/// 消费人次
|
||||
/// </summary>
|
||||
public int UserCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备营业点
|
||||
/// </summary>
|
||||
public List<PlaceCodeNameDetil> detils { get; set; }
|
||||
}
|
||||
|
||||
9
Src/Dlhis.Basic/Device/Response/PlaceCodeNameDetil.cs
Normal file
9
Src/Dlhis.Basic/Device/Response/PlaceCodeNameDetil.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Dlhis.Basic.Device.Response
|
||||
{
|
||||
public class PlaceCodeNameDetil
|
||||
{
|
||||
public string BusinessPlaceCode { get; set; }
|
||||
public string BusinessPlaceName { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user