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:
MGCLatticeSalesOrderPostingServiceA 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:
SalesQtyThe quantity left to post, never negative.
| Name | Type | Optional | Description |
|---|---|---|---|
_salesLine | SalesLine | No | The sales line. |
_documentStatus | DocumentStatus | No | The 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:
MapA map from sales line RecId to the requested quantity; empty when the request carries no lines.
| Name | Type | Optional | Description |
|---|---|---|---|
_salesTable | SalesTable | No | The sales order. |
_lines | List | No | The request's MGCLatticeSalesPostingLineContract lines; may be null. |
_documentStatus | DocumentStatus | No | The 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:
SalesUpdateThe quantity selection for the invoice update.
| Name | Type | Optional | Description |
|---|---|---|---|
_salesId | SalesId | No | The 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:
MGCLatticeOrderOperationResponseContractAn MGCLatticeOrderOperationResponseContract indicating success or failure with details.
| Name | Type | Optional | Description |
|---|---|---|---|
_request | MGCLatticeSalesOrderConfirmRequestContract | No | The 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:
MGCLatticeOrderOperationResponseContractAn MGCLatticeOrderOperationResponseContract indicating success or failure with details.
| Name | Type | Optional | Description |
|---|---|---|---|
_request | MGCLatticeSalesOrderPackingSlipRequestContract | No | The 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:
MGCLatticeOrderOperationResponseContractAn MGCLatticeOrderOperationResponseContract indicating success or failure with details.
| Name | Type | Optional | Description |
|---|---|---|---|
_request | MGCLatticeSalesOrderInvoiceRequestContract | No | The 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:
MGCLatticeStatusQueryResponseContractAn MGCLatticeStatusQueryResponseContract with the sales order status and detail information.
| Name | Type | Optional | Description |
|---|---|---|---|
_request | MGCLatticeStatusQueryRequestContract | No | The 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:
MGCLatticeBulkOperationResponseContractAn MGCLatticeBulkOperationResponseContract containing per-item results.
| Name | Type | Optional | Description |
|---|---|---|---|
_requests | List | No | List 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:
MGCLatticeBulkOperationResponseContractAn MGCLatticeBulkOperationResponseContract containing per-item results.
| Name | Type | Optional | Description |
|---|---|---|---|
_requests | List | No | List 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:
MGCLatticeBulkOperationResponseContractAn MGCLatticeBulkOperationResponseContract containing per-item results.
| Name | Type | Optional | Description |
|---|---|---|---|
_requests | List | No | List 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:
MGCLatticeOrderOperationResponseContractAn MGCLatticeOrderOperationResponseContract: DocumentId is the sales order and PostedDocumentId the canceled packing slip number.
| Name | Type | Optional | Description |
|---|---|---|---|
_request | MGCLatticeSalesPackingSlipCancelRequestContract | No | The 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:
MGCLatticeBulkOperationResponseContractAn MGCLatticeBulkOperationResponseContract containing per-item results.
| Name | Type | Optional | Description |
|---|---|---|---|
_requests | List | No | List of MGCLatticeSalesPackingSlipCancelRequestContract. |