增加设备详情页面
This commit is contained in:
parent
3ac7466122
commit
534826a4bb
|
|
@ -457,7 +457,7 @@ namespace Waste.Application
|
|||
if (BusinessId != Guid.Empty)
|
||||
{
|
||||
var tdbClient = repository.Change<W_BusinessRealData>().Context;
|
||||
int todaydevactivecnt = await repository.Change<W_Device>().Context.Queryable<W_Device>().Where(x => x.Businessid == BusinessId && SqlFunc.DateIsSame(x.LastHeartTime, DateTime.Now)).CountAsync();
|
||||
int todaydevactivecnt = await dbClient.Queryable<W_Device>().Where(x => x.Businessid == BusinessId && SqlFunc.DateIsSame(x.LastHeartTime, DateTime.Now)).CountAsync();
|
||||
int devcnt = await repository.Change<W_Device>().Context.Queryable<W_Device>().Where(x => x.Businessid == BusinessId).CountAsync();
|
||||
int businesscnt = await dbClient.Queryable<W_Business>().Where(x => x.ParentId == BusinessId).CountAsync();
|
||||
if (!await tdbClient.Queryable<W_BusinessRealData>().AnyAsync(x => x.BusinessId == BusinessId))
|
||||
|
|
|
|||
|
|
@ -120,6 +120,35 @@ namespace Waste.Application.Device
|
|||
Id = devicedata.Id
|
||||
};
|
||||
}
|
||||
/// <summary>
|
||||
/// 设备详情数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<DeviceDetailS2Dto> DeviceDetailAsync(Guid id)
|
||||
{
|
||||
var devicedata = await dbClient.Queryable<W_DeviceData>().FirstAsync(x => x.DeviceId == id);
|
||||
var deviceresult = await dbClient.Queryable<W_DeviceResult>().FirstAsync(x => x.DeviceId == id);
|
||||
var device = await dbClient.Queryable<W_Device>().FirstAsync(x => x.Id == id);
|
||||
return new DeviceDetailS2Dto
|
||||
{
|
||||
Id = device.Id,
|
||||
Name = device.Name,
|
||||
Status = device.Status,
|
||||
LastStartTime = devicedata != null ? (devicedata.LastStartTime.HasValue ? devicedata.LastStartTime.ToString() : "-") : "-",
|
||||
LastBeatTime = devicedata != null ? (devicedata.LastBeatTime.HasValue ? devicedata.LastBeatTime.ToString() : "-") : "-",
|
||||
LastHeartTime = device.LastHeartTime,
|
||||
Latitude = devicedata.Latitude,
|
||||
Longitude = devicedata.Longitude,
|
||||
ActiveTime = device.ActiveTime,
|
||||
Address = device.Address,
|
||||
version = devicedata.Version,
|
||||
Tare = device.Tare,
|
||||
Ecode = device.Ecode,
|
||||
FacEcode = device.FacEcode
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备列表
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -100,4 +100,30 @@ namespace Waste.Application
|
|||
/// </summary>
|
||||
public string Secret { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 设备详情
|
||||
/// </summary>
|
||||
public class DeviceDetailS2Dto: W_Device
|
||||
{
|
||||
/// <summary>
|
||||
/// 最近心跳时间
|
||||
/// </summary>
|
||||
public string LastBeatTime { get; set; }
|
||||
/// <summary>
|
||||
/// 最近开机时间
|
||||
/// </summary>
|
||||
public string LastStartTime { get; set; }
|
||||
/// <summary>
|
||||
/// 纬度
|
||||
/// </summary>
|
||||
public string Latitude { get; set; }
|
||||
/// <summary>
|
||||
/// 经度
|
||||
/// </summary>
|
||||
public string Longitude { get; set; }
|
||||
/// <summary>
|
||||
/// 使用的版本号
|
||||
/// </summary>
|
||||
public string version { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,5 +38,11 @@ namespace Waste.Application
|
|||
/// <param name="deviceBatchModel"></param>
|
||||
/// <returns></returns>
|
||||
Task<ResultInfo> BatchSetAsync(DeviceBatchModel deviceBatchModel);
|
||||
/// <summary>
|
||||
/// 设备详情数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<DeviceDetailS2Dto> DeviceDetailAsync(Guid id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -593,6 +593,13 @@
|
|||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Waste.Application.Device.DeviceService.DeviceDetailAsync(System.Guid)">
|
||||
<summary>
|
||||
设备详情数据
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Waste.Application.Device.DeviceService.GetListAsync(Nirvana.Common.QueryParams)">
|
||||
<summary>
|
||||
设备列表
|
||||
|
|
@ -712,6 +719,36 @@
|
|||
设备对应的Secret
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Waste.Application.DeviceDetailS2Dto">
|
||||
<summary>
|
||||
设备详情
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Waste.Application.DeviceDetailS2Dto.LastBeatTime">
|
||||
<summary>
|
||||
最近心跳时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Waste.Application.DeviceDetailS2Dto.LastStartTime">
|
||||
<summary>
|
||||
最近开机时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Waste.Application.DeviceDetailS2Dto.Latitude">
|
||||
<summary>
|
||||
纬度
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Waste.Application.DeviceDetailS2Dto.Longitude">
|
||||
<summary>
|
||||
经度
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Waste.Application.DeviceDetailS2Dto.version">
|
||||
<summary>
|
||||
使用的版本号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Waste.Application.IDeviceService">
|
||||
<summary>
|
||||
设备管理
|
||||
|
|
@ -745,6 +782,13 @@
|
|||
<param name="deviceBatchModel"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Waste.Application.IDeviceService.DeviceDetailAsync(System.Guid)">
|
||||
<summary>
|
||||
设备详情数据
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Waste.Application.JobWorkder">
|
||||
<summary>
|
||||
定时任务
|
||||
|
|
|
|||
|
|
@ -4,13 +4,21 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Waste.Application;
|
||||
|
||||
namespace Waste.Web.Entry.Pages.Device
|
||||
{
|
||||
public class DetailModel : BaseModel
|
||||
{
|
||||
public void OnGet()
|
||||
public DeviceDetailS2Dto data = new DeviceDetailS2Dto();
|
||||
private readonly IDeviceService _deviceService;
|
||||
public DetailModel(IDeviceService deviceService)
|
||||
{
|
||||
_deviceService = deviceService;
|
||||
}
|
||||
public async Task OnGetAsync(Guid id)
|
||||
{
|
||||
data = await _deviceService.DeviceDetailAsync(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,6 +255,12 @@
|
|||
});
|
||||
});
|
||||
});
|
||||
$("body").on("click", ".js-detail", function () {
|
||||
var id = $(this).data('id');
|
||||
common.dialog({
|
||||
content:"/Device/Detail?id="+id
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue