| | |
| | | // Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 |
| | | // |
| | | // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。 |
| | | // |
| | | // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! |
| | | using Microsoft.AspNetCore.SignalR; |
| | | |
| | | using Admin.NET.Core.Service; |
| | | using Microsoft.AspNetCore.Http; |
| | | namespace WCS.Application; |
| | | |
| | | /// <summary> |
| | |
| | | public class WcsAlarmInfoService : IDynamicApiController, ITransient |
| | | { |
| | | private readonly SqlSugarRepository<WcsAlarmInfo> _wcsAlarmInfoRep; |
| | | public WcsAlarmInfoService(SqlSugarRepository<WcsAlarmInfo> wcsAlarmInfoRep) |
| | | private readonly IHubContext<PlcHub, IPlcHub> _plcHubContext; |
| | | |
| | | public WcsAlarmInfoService(SqlSugarRepository<WcsAlarmInfo> wcsAlarmInfoRep, IHubContext<PlcHub, IPlcHub> plcHubContext) |
| | | { |
| | | _wcsAlarmInfoRep = wcsAlarmInfoRep; |
| | | _plcHubContext = plcHubContext; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | [DisplayName("分页查询报警信息表")] |
| | | public async Task<SqlSugarPagedList<WcsAlarmInfoOutput>> Page(PageWcsAlarmInfoInput input) |
| | | { |
| | | input.SearchKey = input.SearchKey?.Trim(); |
| | | input.SearchKey = input.SearchKey?.Trim(); |
| | | var query = _wcsAlarmInfoRep.AsQueryable() |
| | | .WhereIF(!string.IsNullOrEmpty(input.SearchKey), u => |
| | | u.PlcIP.Contains(input.SearchKey) |
| | | || u.Type.Contains(input.SearchKey) |
| | | ) |
| | | .WhereIF(!string.IsNullOrWhiteSpace(input.PlcIP), u => u.PlcIP.Contains(input.PlcIP.Trim())) |
| | | .WhereIF(!string.IsNullOrWhiteSpace(input.Type), u => u.Type.Contains(input.Type.Trim())) |
| | | .WhereIF(input.Status.HasValue, u => u.Status == input.Status) |
| | | .WhereIF(input.Type.HasValue, u => u.Type == input.Type) |
| | | .Select<WcsAlarmInfoOutput>(); |
| | | return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize); |
| | | return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 增加报警信息表 |
| | |
| | | [DisplayName("获取报警信息表列表")] |
| | | public async Task<List<WcsAlarmInfoOutput>> List([FromQuery] PageWcsAlarmInfoInput input) |
| | | { |
| | | return await _wcsAlarmInfoRep.AsQueryable().Select<WcsAlarmInfoOutput>().ToListAsync(); |
| | | return await _wcsAlarmInfoRep.AsQueryable() |
| | | //.WhereIF(!input.Status.IsNullOrEmpty(), s => s.Status == input.Status) |
| | | .Select<WcsAlarmInfoOutput>().ToListAsync(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 复位报警 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ApiDescriptionSettings(Name = "Reset")] |
| | | [DisplayName("复位报警")] |
| | | public async Task Reset() |
| | | { |
| | | //测试推数据用的 |
| | | await _plcHubContext.Clients.All.PublicAlarm(new WcsAlarmInfoOutput() { Id = new Random().Next(), StationNum = "205", AlarmCode = "MB102", AlarmName = "有物品遮挡", AlarmTime = DateTime.Now }); |
| | | //throw Oops.Bah("开发中"); |
| | | |
| | | } |
| | | |
| | | |
| | | } |