DeliverOrderLines - accountsIQ/API-Wiki GitHub Wiki

The DeliverOrderLines delivers partially/fully some or all of the lines of a given order.

An order can be delivered in multiple parts, each one allowing the user to create an invoice of. Several deliveries which have not been invoiced yet can be merged together to create a single invoice.

Declaration

C#

public WSResultStatus DeliverOrderLines(string token, Order order, DeliveryLine[] lines)

Visual Basic

Public Function DeliverOrderLines(ByVal token As String, ByVal order As Order, ByVal lines As DeliveryLine()) As WSResultStatus

Parameter List

Parameter Type Description
token String The session token retrieved during authentication.
stockItemID Order Order which is going to be partially/fully delivered.
lines DeliveryLine[] Array of delivery lines. Each line is related to an order line and is created via the `GetNewDeliveryLine` function. Each line contains a quantity to be delivered and a delivery reference.

Example

The following example part-delivers the first line of a pre-existing order 'ORDER 1' for the customer account 'TESTINTEGR'

C#

Integration_1_1 ws = new Integration_1_1();

String auth = ws.Login(entityID, partnerKey, userKey);
if (auth != null)
{
  // Assumes an order with the external reference 'ORDER 1' exists and has non delivered lines
  accountsIQ.WSResult2OfArrayOfOrder orderResult = ws.GetOrdersByExternalReference(auth, "ORDER 1");
  accountsIQ.Order order = orderResult.Result[orderResult.Result.Length - 1];
  line = order.Lines[0];

  // Get a new delivery line for the first line of the order
  accountsIQ.WSResult2OfDeliveryLine dl = ws.GetNewDeliveryLine(auth, line);
  Assert.IsNotNull(dl);
  Assert.IsTrue(dl.Status == accountsIQ.OperationStatus.Success);
  // Mark the line for delivery for 5 units with the delivery reference '150'
  dl.Result.DeliveredQuantity = 5;
  dl.Result.DeliveryReference = "150";

  // Deliver
  accountsIQ.WSResultStatus dle = ws.DeliverOrderLines(auth, order, new accountsIQ.DeliveryLine[] { dl.Result });
  Assert.IsTrue(dle.Status == accountsIQ.OperationStatus.Created);
}

Visual Basic

Dim ws As New Integration_1_1

Dim auth As String = ws.Login(entityID, partnerKey, userKey)
If (Not auth Is Nothing) Then
    '  Assumes an order with the external reference 'ORDER 1' exists and has non delivered lines
    Dim orderResult As WSResult2OfArrayOfOrder = ws.GetOrdersByExternalReference(auth, "ORDER 1")
    Dim order As accountsiq.Order
    order = orderResult.Result((orderResult.Result.Length - 1))

    ' Get a new delivery line for the first line of the order
    line = result.Result.Lines(0)
    Dim dl As WSResult2OfDeliveryLine = ws.GetNewDeliveryLine(auth, line)
    Assert.IsNotNull(dl)
    Assert.IsTrue((dl.Status = OperationStatus.Success))
    ' Mark the line for delivery for 5 units with the delivery reference '150'
    dl.Result.DeliveredQuantity = 5
    dl.Result.DeliveryReference = "150"

    ' Deliver
    Assert.IsTrue((ws.DeliverOrderLines(auth, order, New DeliveryLine() { dl.Result }).Status = OperationStatus.Created))
End If

See Also

⚠️ **GitHub.com Fallback** ⚠️