using GB5Shared.ListQuery; namespace MMDAL.DTO.Allocation { // ───────────────────────────────────────────────────────────────────── // PendingAllocationSelectListDTO // // GB4 Source: AllocationService.GetPendingSelectList (Allocation.svc.cs) // -> AllocationBLL.GetPendingSelectList // // GB4 behaviour: fetched the full pending-allocation list (GetPending), // then built two in-memory DataTables and manually filtered out // duplicate rows keyed on (BizTransactionTypeId, ObjectHeaderTypeId, // AllocationObjectHeaderId, HeaderName, ItemId, ItemName) to produce a // distinct pick-list for the Allocation-matching screen's dropdown. // // GB5 change: SELECT DISTINCT on the same 6 key columns does the dedup // in SQL. Runs through the standard List-Query pipeline (IQueryBuilder + // GenericListHandler) instead of a raw dynamic-JSON DAL call, so the // result is typed and paged like every other GB5 list endpoint. // ───────────────────────────────────────────────────────────────────── public sealed class PendingAllocationSelectListDTO { public int BizTransactionTypeId { get; set; } public int BizTransactionClassId { get; set; } public int ObjectHeaderTypeId { get; set; } public int AllocationObjectHeaderId { get; set; } public int ObjectTypeId { get; set; } public int OUId { get; set; } public string? HeaderName { get; set; } public int ItemId { get; set; } public string? ItemName { get; set; } public int TotalCount { get; set; } // window COUNT(*) OVER() } // ───────────────────────────────────────────────────────────────────── // Criteria // // GB4 parity: GetPending's field-recognition if/else chain only ever // honoured biztransactionclassid, objectheadertypeid, objecttypeid and // ouid (among others) as real filters for this call — every other field // in the legacy Allocation-matching screen's shared criteria bag // (AllotedBizTransactionClassId, AllotedHeaderTypeId, AllotedObjectTypeId, // UseBizTransactionClassId, Nature — fields belonging to a *different* // GB4 query, the target/used-side quantity reconciliation branch) were // silently ignored. [CriteriaField] binding reproduces that naturally: // CriteriaBinder only sets properties it finds a matching key for and // ignores every other incoming field, so those fields simply have no // property here and are dropped without needing an explicit blocklist. // ───────────────────────────────────────────────────────────────────── public sealed class PendingAllocationSelectListCriteria : IListCriteria { [CriteriaField("headername", "searchtext")] public string? SearchText { get; set; } [CriteriaField("ouid")] public int? OUId { get; set; } [CriteriaField("pagesize")] public int PageSize { get; set; } = 200; [CriteriaField("pageoffset")] public int PageOffset { get; set; } = 0; [CriteriaField("biztransactionclassid")] public int? BizTransactionClassId { get; set; } [CriteriaField("objectheadertypeid")] public int? ObjectHeaderTypeId { get; set; } [CriteriaField("objecttypeid")] public int? ObjectTypeId { get; set; } [CriteriaField("itemid")] public int? ItemId { get; set; } // ── ISortable ──────────────────────────────────────────────────── [CriteriaField("sortby")] public string? SortBy { get; set; } [CriteriaField("sortdesc", IsFlag = true)] public bool SortDesc { get; set; } [CriteriaField("sortfields")] public string[]? SortFields { get; set; } // ── IPageable ──────────────────────────────────────────────────── [CriteriaField("cursorid")] public int? CursorId { get; set; } [CriteriaField("skipcount", IsFlag = true)] public bool SkipCount { get; set; } } public sealed record PendingAllocationSelectListQuery(PendingAllocationSelectListCriteria Criteria) : IListQuery; }