SetLocationBatches

This function allows you to set the stock balance at a single location for several articles and batches, at the same time. The way it works is:

  1. You specify a single location, and a list of articles, batch numbers (optional), and quantities.
  2. Ongoing WMS compares your list to what exists in Ongoing WMS.
  3. If there are differences, Ongoing WMS attempts to execute inventory transactions so that the quantities in Ongoing WMS will match the ones which you specified.
  4. Ongoing WMS returns the differences between our stock balance and your stock balance.

Essentially, this allows an external system to "own" the stock balance at a particular location.

If you specify DryRun = true, then Ongoing WMS will not actually perform any inventory transactions. We will simply return the stock balance differences.

By default, any article or batch which is not included in your list, will be set to quantity 0. If don't want this to happen, specify RemoveByInventoryBatchesNotSpecified = false.

Tags: SetLocationBatches, SetLocationBatchesOperation, InventoryAdjustmentCauseClass, LocationBatch, SetLocationBatchesHandling, SetLocationBatchesResponse, SetLocationBatchesResult, SetLocationBatchesError, LocationBatchDifference

Request XML

POST /xxx/Automation.asmx HTTP/1.1
Host: api.ongoingsystems.se
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://ongoingsystems.se/Automation/SetLocationBatches"

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <SetLocationBatches xmlns="http://ongoingsystems.se/Automation">
      <UserName>string</UserName>
      <Password>string</Password>
      <Operation>
        <Location>string</Location>
        <InventoryNumber>string</InventoryNumber>
        <InventoryAdjustmentCause>
          <Code>string</Code>
        </InventoryAdjustmentCause>
        <Batches>
          <LocationBatch>
            <ArticleDefId>int</ArticleDefId>
            <Batch>string</Batch>
            <NumberOfItems>decimal</NumberOfItems>
          </LocationBatch>
          <LocationBatch>
            <ArticleDefId>int</ArticleDefId>
            <Batch>string</Batch>
            <NumberOfItems>decimal</NumberOfItems>
          </LocationBatch>
        </Batches>
        <Handling>
          <AllowDeAllocationOfOrders>boolean</AllowDeAllocationOfOrders>
          <RemoveByInventoryBatchesNotSpecified>boolean</RemoveByInventoryBatchesNotSpecified>
          <AllowIncreaseNumberOfItems>boolean</AllowIncreaseNumberOfItems>
        </Handling>
        <GoodsOwnerId>int</GoodsOwnerId>
        <DryRun>boolean</DryRun>
      </Operation>
    </SetLocationBatches>
  </soap:Body>
</soap:Envelope>

Request specification

SetLocationBatches
UserName string(50) Req. Your username
Password string(50) Req. Your password
Operation SetLocationBatchesOperation Req. The operation object
SetLocationBatchesOperation
Location string(50) Req. The location where you want to set the article quantities.
InventoryNumber string(50) A reference number for the inventory transactions which may be made to fulfil the API call.
InventoryAdjustmentCause InventoryAdjustmentCauseClass If you want the inventory transactions to have a specific adjustment cause, send it in this field.
Batches LocationBatch[] Req. A list of LocationBatches. Each location batch contains information about the article, batch number (if any), and the quantity.
Handling SetLocationBatchesHandling An object of type SetLocationBatchesHandling. Allows you to customize how you want to Ongoing WMS to handle your request.
GoodsOwnerId int Goods owner id.
DryRun boolean If true, then Ongoing WMS will perform a dry run, that is, Ongoing WMS will compute the necessary inventory transactions which need to be performed, and return them to you, but Ongoing WMS will not actually execute the inventory transactions.
InventoryAdjustmentCauseClass
Code string The identifier for the inventory adjustment cause
LocationBatch
ArticleDefId int Req. Ongoing WMS internal id for the article.
Batch string(50) Batch number.
NumberOfItems decimal Number of items.
SetLocationBatchesHandling
AllowDeAllocationOfOrders boolean If the location contains items which are allocated, is Ongoing WMS allowed to deallocate them? This may be necessary in order to fulfil the API call. Default: true
RemoveByInventoryBatchesNotSpecified boolean If the location contains a batch number which was NOT sent in LocationBatch, should Ongoing WMS remove it from the location? Default: true.
AllowIncreaseNumberOfItems boolean Is Ongoing WMS allowed to increase the number of items in stock? Default: true

Response XML

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <SetLocationBatchesResponse xmlns="http://ongoingsystems.se/Automation">
      <SetLocationBatchesResult>
        <SetLocationBatchesErrors>
          <SetLocationBatchesError>
            <Message>string</Message>
            <ErrorType>UnknownError or LogonError or LocationNotFound or InventoryNumberAlreadyExists or ArticleNotFound or ErrorSavingInventory or BelowZeroTransaction or ArticleIsDeleted or GoodsOwnerIsDeleted or BatchNumberOfItemsWouldBeIncreased or GoodsOwerIdNotFound</ErrorType>
          </SetLocationBatchesError>
          <SetLocationBatchesError>
            <Message>string</Message>
            <ErrorType>UnknownError or LogonError or LocationNotFound or InventoryNumberAlreadyExists or ArticleNotFound or ErrorSavingInventory or BelowZeroTransaction or ArticleIsDeleted or GoodsOwnerIsDeleted or BatchNumberOfItemsWouldBeIncreased or GoodsOwerIdNotFound</ErrorType>
          </SetLocationBatchesError>
        </SetLocationBatchesErrors>
        <Success>boolean</Success>
        <DryRun>boolean</DryRun>
        <BatchDifferences>
          <LocationBatchDifference>
            <OngoingNumberOfItems>decimal</OngoingNumberOfItems>
            <ExternalNumberOfItems>decimal</ExternalNumberOfItems>
            <ArticleDefId>int</ArticleDefId>
            <GoodsOwnerId>int</GoodsOwnerId>
            <Batch>string</Batch>
          </LocationBatchDifference>
          <LocationBatchDifference>
            <OngoingNumberOfItems>decimal</OngoingNumberOfItems>
            <ExternalNumberOfItems>decimal</ExternalNumberOfItems>
            <ArticleDefId>int</ArticleDefId>
            <GoodsOwnerId>int</GoodsOwnerId>
            <Batch>string</Batch>
          </LocationBatchDifference>
        </BatchDifferences>
      </SetLocationBatchesResult>
    </SetLocationBatchesResponse>
  </soap:Body>
</soap:Envelope>

Response specification

SetLocationBatchesResponse
SetLocationBatchesResult SetLocationBatchesResult
SetLocationBatchesResult
SetLocationBatchesErrors SetLocationBatchesError[] A list of SetLocationBatchesError objects
Success boolean True if successful, false otherwise.
DryRun boolean True if this was only a dry run, false otherwise.
BatchDifferences LocationBatchDifference[] A list of LocationBatchDifference objects, specifying what differences were found between Ongoing WMS and the list which was sent in the API call.
SetLocationBatchesError
Message string Message explaining the error.
ErrorType enum The type of error:
- UnknownError
- LogonError
- LocationNotFound
- InventoryNumberAlreadyExists
- ArticleNotFound
- ErrorSavingInventory
- BelowZeroTransaction
- ArticleIsDeleted
- GoodsOwnerIsDeleted
- BatchNumberOfItemsWouldBeIncreased
- GoodsOwerIdNotFound
LocationBatchDifference
OngoingNumberOfItems decimal The number of items in Ongoing WMS.
ExternalNumberOfItems decimal The number of items which was specified in the API call.
ArticleDefId int Ongoing WMS internal id of the article.
GoodsOwnerId int Goods owner id.
Batch string(50) Batch number.