using FastEndpoints; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.MRPRun; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.MRPRun { // Returns the paged planning workbench for a given MRP run. // Request shape matches GetSelectListSkill: a generic CriteriaDTO filter payload. // MRPRunId is mandatory; PlanType, Status, MakrOrBuy, SubCategoryId, PartyId, // CategoryId, FromItem/ToItem, PeriodFromDate/PeriodToDate and OnlyParent are all // optional — see WorkBenchCriteriaDTO.FromCriteria (GB4 parity, MRPRun.svc.cs // GetWorkBenchDetail). public class GetMRPWorkbench : BaseEndpoint> { private readonly IMRPActionBLL _MRPActionBLL; public GetMRPWorkbench(IMRPActionBLL mrpActionBLL) => _MRPActionBLL = mrpActionBLL; public override void Configure() { Post("/MRPRun/GetMRPWorkbench"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override string? GetCacheKey(Params req, LoginDTO login) => null; protected override async Task> ExecuteAsync( Params req, LoginDTO loginDTO, CancellationToken ct) { var result = await _MRPActionBLL.GetWorkbench(req.CriteriaDTO, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, loginDTO); } } }