hwh
2024-09-03 11cea3bba7ac11d67c1110f3a922c8a19cb5a57d
Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs
@@ -1,6 +1,4 @@
using Microsoft.AspNetCore.SignalR;
namespace WCS.Application;
namespace WCS.Application;
/// <summary>
/// 报警信息表服务
@@ -9,12 +7,9 @@
public class WcsAlarmInfoService : IDynamicApiController, ITransient
{
    private readonly SqlSugarRepository<WcsAlarmInfo> _wcsAlarmInfoRep;
    private readonly IHubContext<PlcHub, IPlcHub> _plcHubContext;
    public WcsAlarmInfoService(SqlSugarRepository<WcsAlarmInfo> wcsAlarmInfoRep, IHubContext<PlcHub, IPlcHub> plcHubContext)
    public WcsAlarmInfoService(SqlSugarRepository<WcsAlarmInfo> wcsAlarmInfoRep)
    {
        _wcsAlarmInfoRep = wcsAlarmInfoRep;
        _plcHubContext = plcHubContext;
    }
    /// <summary>
@@ -51,6 +46,7 @@
    public async Task<long> Add(AddWcsAlarmInfoInput input)
    {
        var entity = input.Adapt<WcsAlarmInfo>();
        entity.Status = YesNoEnum.N;
        await _wcsAlarmInfoRep.InsertAsync(entity);
        return entity.Id;
    }
@@ -108,7 +104,7 @@
    public async Task<List<WcsAlarmInfoOutput>> List([FromQuery] PageWcsAlarmInfoInput input)
    {
        return await _wcsAlarmInfoRep.AsQueryable()
            //.WhereIF(!input.Status.IsNullOrEmpty(), s => s.Status == input.Status)
            .WhereIF(!input.Status.IsNullOrEmpty(), s => s.Status == input.Status)
            .Select<WcsAlarmInfoOutput>().ToListAsync();
    }
@@ -123,10 +119,7 @@
    [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("开发中");
        throw Oops.Bah("开发中");
    }