hwh
2024-09-05 7bb43fd6a2d62060c2f622e8d9396329ebaf4794
Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs
@@ -10,7 +10,6 @@
{
    private readonly SqlSugarRepository<WcsAlarmInfo> _wcsAlarmInfoRep;
    private readonly IHubContext<PlcHub, IPlcHub> _plcHubContext;
    public WcsAlarmInfoService(SqlSugarRepository<WcsAlarmInfo> wcsAlarmInfoRep, IHubContext<PlcHub, IPlcHub> plcHubContext)
    {
        _wcsAlarmInfoRep = wcsAlarmInfoRep;
@@ -51,6 +50,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 +108,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();
    }
@@ -124,9 +124,10 @@
    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("开发中");
        await _plcHubContext.Clients.All.PublicAlarm(new List<WcsAlarmInfo>() { new WcsAlarmInfo() { Id = 100, StationNum = "260", AlarmCode = "MB102", AlarmName = "有物品遮挡", AlarmTime = DateTime.Now, Status = YesNoEnum.N } });
        //await _plcHubContext.Clients.All.PublicAlarm(new WcsAlarmInfo() { Id = 100, StationNum = "260", AlarmCode = "MB102", AlarmName = "有物品遮挡", AlarmTime = DateTime.Now, Status = YesNoEnum.Y });
        //throw Oops.Bah("开发中");
    }