IRobotRepository.cs 3.74 KB
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Rcs.Domain.Entities;

namespace Rcs.Domain.Repositories;

/// <summary>
/// 机器人仓储接口
/// </summary>
public interface IRobotRepository : IRepository<Robot>
{
    /// <summary>
    /// 获取机器人列表
    /// </summary>
    Task<Robot?> GetByIdFullAsync(Guid id,
        CancellationToken cancellationToken = default);
    /// <summary>
    /// 获取机器人列表
    /// </summary>
    Task<IEnumerable<Robot>?> GetRobotsAsync(
        CancellationToken cancellationToken = default);
    /// <summary>
    /// 根据机器人编码获取机器人
    /// </summary>
    Task<Robot?> GetByRobotCodeAsync(
        string robotCode,
        CancellationToken cancellationToken = default);
    /// <summary>
    /// 根据机器人编码获取机器人
    /// </summary>
    Task<Robot?> GetByIdFullDataAsync(
        Guid robotId,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// 根据序列号获取机器人
    /// </summary>
    Task<Robot?> GetBySerialNumberAsync(
        string serialNumber,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// 根据制造商和序列号获取机器人
    /// @author zzy
    /// </summary>
    Task<Robot?> GetByManufacturerAndSerialNumberAsync(
        string manufacturer,
        string serialNumber,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// 获取所有在线机器人
    /// </summary>
    Task<IEnumerable<Robot>> GetOnlineRobotsAsync(
        CancellationToken cancellationToken = default);

    /// <summary>
    /// 获取所有激活的机器人
    /// </summary>
    Task<IEnumerable<Robot>> GetActiveRobotsAsync(
        CancellationToken cancellationToken = default);

    /// <summary>
    /// 根据状态获取机器人列表
    /// </summary>
    Task<IEnumerable<Robot>> GetByStatusAsync(
        RobotStatus status,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// 根据机器人类型获取机器人列表
    /// </summary>
    Task<IEnumerable<Robot>> GetByRobotTypeAsync(
        RobotType robotType,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// 获取所有空闲机器人
    /// </summary>
    Task<IEnumerable<Robot>> GetIdleRobotsAsync(
        CancellationToken cancellationToken = default);

    /// <summary>
    /// 根据制造商获取机器人列表
    /// </summary>
    Task<IEnumerable<Robot>> GetByManufacturerAsync(
        string manufacturer,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// 根据当前节点获取机器人列表
    /// </summary>
    Task<IEnumerable<Robot>> GetByCurrentNodeAsync(
        Guid nodeCodeId,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// 根据条件筛选机器人列表
    /// </summary>
    /// <param name="robotCode">机器人编码</param>
    /// <param name="robotName">机器人名称</param>
    /// <param name="robotManufacturer">制造商</param>
    /// <param name="robotSerialNumber">序列号</param>
    /// <param name="robotType">机器人类型</param>
    /// <param name="active">是否启用</param>
    /// <param name="cancellationToken">取消令牌</param>
    /// <returns>筛选后的机器人列表</returns>
    Task<(IEnumerable<Robot> Robots, int TotalCount)> GetByFilterAsync(
        string? robotCode = null,
        string? robotName = null,
        string? robotManufacturer = null,
        string? robotSerialNumber = null,
        string? robotType = null,
        bool? active = null,
        int pageNumber = 1,
        int pageSize = 10,
        CancellationToken cancellationToken = default);
}