Skip to main content

MGCLatticeSalesOrderPostingService

Custom service for sales order posting operations including confirmation, packing slip, and invoicing. A request without lines posts the whole order. A request with lines posts only the selected lines and their quantities: each line is resolved to exactly one order line and its quantity is written to that line's deliver-now quantity before a SalesUpdate::DeliverNow update (see resolveRequestedSalesLines). Sales confirmation, packing slip and invoice numbers always come from their number sequences; the posted number is returned as PostedDocumentId (and replayed with it for a repeated RequestId). DocumentId is the sales order. cancelSalesPackingSlip cancels a posted packing slip the way the packing slip journal's Cancel does and returns the canceled packing slip as PostedDocumentId.

Methods​

new​

Initializes a new instance of the MGCLatticeSalesOrderPostingService class.

  • Visibility: public
  • Returns: void

No parameters.

construct​

Creates a new instance of the MGCLatticeSalesOrderPostingService class.

  • Visibility: public
  • Returns: MGCLatticeSalesOrderPostingService A new MGCLatticeSalesOrderPostingService instance.

No parameters.

postableSalesQty​

The quantity, in the sales unit, that a posting of _documentStatus can still take from a sales line: the quantity not yet delivered for a confirmation or packing slip, plus the quantity delivered but not yet invoiced for an invoice. Return lines carry negative quantities, so the size of the quantity is returned.

  • Visibility: public
  • Returns: SalesQty The quantity left to post, never negative.
NameTypeOptionalDescription
_salesLineSalesLineNoThe sales line.
_documentStatusDocumentStatusNoThe document being posted.

resolveRequestedSalesLines​

Resolves the selected request lines to the order lines they name (see findRequestedSalesLine) and checks each requested quantity: it must be greater than zero and at most the quantity left to post (postableSalesQty), and no two request lines may name the same order line. A line is selected unless it says IsSelected: false (the contract defaults it to true); unselected lines are skipped, and a request whose lines are all unselected is refused, so it never posts the whole order. Every violation fails the request as ValidationFailed before anything is written.

  • Visibility: public
  • Returns: Map A map from sales line RecId to the requested quantity; empty when the request carries no lines.
NameTypeOptionalDescription
_salesTableSalesTableNoThe sales order.
_linesListNoThe request's MGCLatticeSalesPostingLineContract lines; may be null.
_documentStatusDocumentStatusNoThe document being posted.

invoiceQuantity​

The quantity an invoice of the whole order posts: once the order has packing slips, what was delivered (SalesUpdate::PackingSlip, the packing slip quantities still to invoice), as the purchase side invoices what was received; an order without packing slips is invoiced for its ordered quantity (SalesUpdate::All).

  • Visibility: public
  • Returns: SalesUpdate The quantity selection for the invoice update.
NameTypeOptionalDescription
_salesIdSalesIdNoThe sales order.

confirmSalesOrder​

Confirms a sales order by posting the confirmation journal via SalesFormLetter. Without request lines the whole order is confirmed; with lines, only the selected lines and quantities. The confirmation number is returned as PostedDocumentId.

  • Visibility: public
  • Returns: MGCLatticeOrderOperationResponseContract An MGCLatticeOrderOperationResponseContract indicating success or failure with details.
NameTypeOptionalDescription
_requestMGCLatticeSalesOrderConfirmRequestContractNoThe request containing SalesOrderId, PostingDate, optional Lines, and standard header fields.

postSalesPackingSlip​

Posts a packing slip for a sales order using SalesFormLetter with DocumentStatus::PackingSlip. Without request lines everything not yet delivered ships; with lines, only the selected lines and quantities. The packing slip number comes from the number sequence and is returned as PostedDocumentId.

  • Visibility: public
  • Returns: MGCLatticeOrderOperationResponseContract An MGCLatticeOrderOperationResponseContract indicating success or failure with details.
NameTypeOptionalDescription
_requestMGCLatticeSalesOrderPackingSlipRequestContractNoThe request containing SalesOrderId, PostingDate, optional Lines, and standard header fields.

invoiceSalesOrder​

Posts an invoice for a sales order using SalesFormLetter with DocumentStatus::Invoice. Without request lines an order with packing slips is invoiced for what was delivered and an order without packing slips for its ordered quantity (invoiceQuantity); with lines, only the selected lines and quantities. The invoice number comes from the number sequence and is returned as PostedDocumentId.

  • Visibility: public
  • Returns: MGCLatticeOrderOperationResponseContract An MGCLatticeOrderOperationResponseContract indicating success or failure with details.
NameTypeOptionalDescription
_requestMGCLatticeSalesOrderInvoiceRequestContractNoThe request containing SalesOrderId, PostingDate, optional Lines, and standard header fields.

getSalesOrderStatus​

Queries the current status of a sales order including confirmation, packing slip, and invoice dates.

  • Visibility: public
  • Returns: MGCLatticeStatusQueryResponseContract An MGCLatticeStatusQueryResponseContract with the sales order status and detail information.
NameTypeOptionalDescription
_requestMGCLatticeStatusQueryRequestContractNoThe request containing DocumentId (SalesId) and standard header fields.

confirmSalesOrderBatch​

Confirms multiple sales orders in a single bulk operation. A missing (null) item fails on its own as ValidationFailed (addBulkNullItemResult) without stopping the batch.

  • Visibility: public
  • Returns: MGCLatticeBulkOperationResponseContract An MGCLatticeBulkOperationResponseContract containing per-item results.
NameTypeOptionalDescription
_requestsListNoList of MGCLatticeSalesOrderConfirmRequestContract.

postSalesPackingSlipBatch​

Posts packing slips for multiple sales orders in a single bulk operation. A missing (null) item fails on its own as ValidationFailed (addBulkNullItemResult) without stopping the batch.

  • Visibility: public
  • Returns: MGCLatticeBulkOperationResponseContract An MGCLatticeBulkOperationResponseContract containing per-item results.
NameTypeOptionalDescription
_requestsListNoList of MGCLatticeSalesOrderPackingSlipRequestContract.

invoiceSalesOrderBatch​

Invoices multiple sales orders in a single bulk operation. A missing (null) item fails on its own as ValidationFailed (addBulkNullItemResult) without stopping the batch.

  • Visibility: public
  • Returns: MGCLatticeBulkOperationResponseContract An MGCLatticeBulkOperationResponseContract containing per-item results.
NameTypeOptionalDescription
_requestsListNoList of MGCLatticeSalesOrderInvoiceRequestContract.

cancelSalesPackingSlip​

Cancels a posted sales packing slip the way Sales order > Packing slip journal > Cancel does: the standard packing slip posting runs as a cancellation (SalesFormLetter_PackingSlip started from the SalesFormLetter_PackingSlipCancel action, as Microsoft's test library does), which reverses the physical delivery, its inventory and its ledger postings and adds a version with zero quantities to the packing slip. The request names the sales order (or its external key) and optionally the packing slip; without one, the order's only packing slip that can be canceled is canceled.

  • Visibility: public
  • Returns: MGCLatticeOrderOperationResponseContract An MGCLatticeOrderOperationResponseContract: DocumentId is the sales order and PostedDocumentId the canceled packing slip number.
NameTypeOptionalDescription
_requestMGCLatticeSalesPackingSlipCancelRequestContractNoThe request containing SalesOrderId (or SalesOrderIdExternalKey), optional PackingSlipId, and standard header fields.

cancelSalesPackingSlipBatch​

Cancels several sales packing slips in a single bulk operation; each item runs as one cancelSalesPackingSlip. A missing (null) item fails on its own as ValidationFailed (addBulkNullItemResult) without stopping the batch.

  • Visibility: public
  • Returns: MGCLatticeBulkOperationResponseContract An MGCLatticeBulkOperationResponseContract containing per-item results.
NameTypeOptionalDescription
_requestsListNoList of MGCLatticeSalesPackingSlipCancelRequestContract.