namespace DXPBLL.VendorPo; // A LEAN mirror of MM's MMDAL.DTO.MMHead.MMHeadDTO/MMDetailDTO (which are 3000+ lines each, // covering lots/packs/schedules/allocations DXP never touches) — posted as JSON directly to // MM's own POST /MMHead/SaveMMHead, which deserializes into the FULL MMHeadDTO server-side. // Properties not set here simply keep MMHeadDTO's own C# field-initializer defaults (mostly -1 // or empty list) — confirmed safe via a full read of MMHeadBLL.SaveBatchAsync (see Phase 1.4 of // the plan). MMHeadId/DocumentId/MMDetailId/ConfigVersionId are deliberately NOT settable here — // MM's AssignIds/SaveBatchAsync assigns/overwrites them unconditionally. // // DBMS-neutral note: this DTO crosses the wire as JSON, not SQL — no dialect concern here. public class MmDocumentSaveRequestDTO { public int BizTransactionTypeId { get; set; } public int OUId { get; set; } public int MMHeadPeriodId { get; set; } = -1; public DateTime MMHeadDate { get; set; } = DateTime.UtcNow; public string? MMHeadNumber { get; set; } // leave null when the BizTransactionType is configured for Auto document numbering public int PartyId { get; set; } = -1; public int StoreId { get; set; } = -1; public int FromStoreId { get; set; } = -1; public int ToStoreId { get; set; } = -1; public int GateEntryId { get; set; } = -1; public string? MMHeadReferenceNumber { get; set; } // links this document back to the originating PO (its MMHeadNumber) public DateTime? MMHeadReferenceDate { get; set; } public string? MMHeadRemarks { get; set; } // free-text dispatch details (vehicle/transporter) — Phase 1 does not resolve these to // MVEHICLE/MTRANSPORTER master IDs; a deliberate simplification, see Part 4 of the plan public List MMDetailArray { get; set; } = new(); } public class MmDocumentDetailSaveRequestDTO { public short MMDetailSlNo { get; set; } public int ItemId { get; set; } = -1; public int SKUId { get; set; } = -1; public decimal MMDetailTransactionQuantity { get; set; } public int TransactionUOMId { get; set; } = -1; public decimal MMDetailRate { get; set; } public int TransactionRateUOMId { get; set; } = -1; public int TransactionCurrencyId { get; set; } = -1; public int StoreId { get; set; } = -1; } public class MmDocumentSaveOutcome { public bool Success { get; set; } public string? Error { get; set; } // NOTE: SaveMMHead's response is a plain success MESSAGE STRING (not the new document's // ID), per MMHeadBLL.SaveMMHead's `resultList.FirstOrDefault()` return shape — so this // outcome deliberately does NOT surface a DocumentId. AsnBLL looks up the newly created // document by its own ReferenceNumber/BizTransactionTypeId/PartyId afterward instead // (see AsnBLL.cs) — a defensible lookup since DXP controls what it sets as the reference. }