RobotNet/RobotNet.RobotManager/Controllers/TrafficACSRequestController.cs
2025-10-15 15:15:53 +07:00

26 lines
941 B
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using RobotNet.RobotManager.Services.OpenACS;
using RobotNet.RobotShares.OpenACS;
using RobotNet.Shares;
namespace RobotNet.RobotManager.Controllers;
[Route("api/[controller]")]
[ApiController]
[Authorize]
public class TrafficACSRequestController(TrafficACS TrafficACS, Services.RobotManager RobotManager) : ControllerBase
{
[HttpPost]
public async Task<MessageResult<bool>> UpdateTrafficSetting([FromBody] TrafficACSRequestModel model)
=> model.Type switch
{
TrafficRequestType.IN => await TrafficACS.RequestIn(model.RobotId, model.ZoneId),
TrafficRequestType.OUT => await TrafficACS.RequestOut(model.RobotId, model.ZoneId),
_ => await TrafficACS.RequestOut(model.RobotId, model.ZoneId),
};
[HttpGet]
public RobotACSLockedDto[] GetRobotLocked() => RobotManager.GetRobotACSLocked();
}