Files
zentral/src/Apollinare.API/Modules/Production/Controllers/MrpController.cs
2025-12-01 10:00:40 +01:00

39 lines
1.1 KiB
C#

using Apollinare.API.Modules.Production.Dtos;
using Apollinare.API.Modules.Production.Services;
using Apollinare.Domain.Entities.Production;
using Microsoft.AspNetCore.Mvc;
namespace Apollinare.API.Modules.Production.Controllers;
[ApiController]
[Route("api/production/mrp")]
public class MrpController : ControllerBase
{
private readonly IMrpService _mrpService;
public MrpController(IMrpService mrpService)
{
_mrpService = mrpService;
}
[HttpPost("run")]
public async Task<IActionResult> RunMrp([FromBody] MrpConfigurationDto config)
{
await _mrpService.RunMrpAsync(config);
return Ok(new { message = "MRP Run completed successfully" });
}
[HttpGet("suggestions")]
public async Task<ActionResult<List<MrpSuggestion>>> GetSuggestions([FromQuery] bool includeProcessed = false)
{
return await _mrpService.GetSuggestionsAsync(includeProcessed);
}
[HttpPost("suggestions/{id}/process")]
public async Task<IActionResult> ProcessSuggestion(int id)
{
await _mrpService.ProcessSuggestionAsync(id);
return Ok();
}
}