using FastEndpoints; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.Allocation; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.Allocation { // ───────────────────────────────────────────────────────────────────── // GetSelectListTPendingAllocation – POST /Allocation/GetSelectListTPendingAllocation // // GB4 Source: AllocationService.GetPendingNewListForProductionPlan (Allocation.svc.cs). // GB4's real route for this method is /Allocation/PendingAllocationSelectList — the // closest textual match to this GB5 route name, which is why this endpoint is wired // to it rather than GetPendingSelectList (GB4 route /Allocation/SelectList, which // returns the simpler 6-field AllocationDTO dedup shape — see GetPendingSelectList.cs). // // Returns List JSON, matching GB4's response shape exactly // (WarpTypeId/LabelId/Repeats/DesignNo for the MM-Document compact production-plan // branch, plus the shared Indent/full-item-detail branches). // ───────────────────────────────────────────────────────────────────── public class GetSelectListTPendingAllocation : BaseEndpoint> { private readonly IAllocationBLL _bll; public GetSelectListTPendingAllocation(IAllocationBLL bll) => _bll = bll; public override void Configure() { Post("/Allocation/GetSelectListTPendingAllocation"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override async Task> ExecuteAsync( Params req, LoginDTO login, CancellationToken ct) { try { var result = await _bll.GetPendingNewListForProductionPlan(req.CriteriaDTO, login); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, login); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError( ex, CacheKeyLevel.NOT_REQUIRED, login, ex.Message, 500); } } } }