API - MES Output


Overview

This is an API to create an output transaction in the MES transaction queue.

An output is the production of trade items on a production lot, similar to a positive adjustment: for each line, a trade item is created. The produced trade items can be put on a pallet, and reserved directly to a Delivery Agreement. Standard items (BC items) are output on a Released Production Order.

Working with an output has two steps (details in How it works):

  1. Endpoint: the MES posts to the endpoint, and the MES transaction is created. Nothing else is changed in BC yet.

  2. Processing: the MES processor (job queue) error checks the transaction and posts it in BC (lot, pallet, trade items, reservation, or output on the Production Order).

See more information about the workflow: MES Use Case: Production

Endpoint name

mes/output older: mesOutput

Source table

WiFiAPIs MES Transaction Line

Fixed view/defaults

This endpoint will only create/show transactions with Type = Output.

Requests allowed

  • POST is used to create transactions

  • PATCH is not allowed.

  • DELETE is not allowed.

  • GET is possible, but not recommended since this endpoint is specifically designed to insert entries. To view transactions, it is better to use API - MES Transactions

Primary key

The primary key of a transaction line is transactionId + lineNo

Record ID

The record ID is systemId

Procedures

None

Data

Field List

Property

Type

Format

Description


systemId

string

uuid

The automatic system ID, which is in GUID format.

record id

non-editable

transactionId

integer


The Transaction this line belongs to.

  • Skip this when creating a new transaction.

  • Can be used to add a line to a transaction that already has been created. If used, the transaction with this ID must already exist. It is not possible to use an ID that does not exist.

PRIMARY KEY

OPTIONAL

lineNo

integer


The sequence number of this line, within the transaction which has ID = transactionId. This is set automatically as the next number.

PRIMARY KEY

non-editable

terminal

string

max 10

The terminal will indicate from which manufacturing unit or machine this entry comes from. This could for example be one packing station. This is mandatory, but if there is only one terminal, this can be set up as a default on page API Base Setup.

OPTIONAL

externalReference

string

max 10

The sender needs to use their own reference, because every transaction needs to be unique. The same external reference can be used repeatedly in order to add an item line (for example a new package) to a transaction already created.

Mandatory

lot

string

max 10

The production lot to post this output on. All lines of a transaction have the same lot. For standard items on a Production Order, this is also the lot (item tracking) of the output.

Mandatory

productionDate

string

date

Production date for the items. If not given, today.

OPTIONAL

expirationDate

string

date

Expiration date for the items. If not given, the system will calculate it automatically.

OPTIONAL

location

string

max 10

The location of the produced item / trade item.

OPTIONAL

itemNo

string

max 20

Item No.

Mandatory

quantity

decimal


quantity and unitOfMeasure are mandatory, unless weight is used instead. A negative quantity is a credit (see How it works).

Mandatory *

unitOfMeasure

string

max 10

The unit of measure that belongs to the quantity field.

Mandatory *

weight

decimal


Weight, if used, it is the weight in the base weight unit of Wisefish.

Mandatory *

weightUnitOfMeasure

string

max 10

Only to be used for irregular items, or when real weight must be registered. Or when weight is in another unit than the general weight unit of the system.

If not given, it will be set as the Weight Unit of the item.

OPTIONAL

pieces

decimal


For some trade items, the number of pieces is given and saved on the Trade Item record. This can for example be number of fish in a box.

OPTIONAL

tradeItemBarcode

string

max 22

If given, this will be the Trade Item Barcode on the Trade Item entry.

OPTIONAL

palletBarcode

string

max 20

If this trade item was put on a pallet, give the pallet barcode in this property.

OPTIONAL

palletNo

string

max 20

If the pallet has already been created, this field can be skipped.

OPTIONAL

documentType

string

enum

The type of the document in documentNo. Values:

  • SalesAgreement - a Delivery Agreement (trade items)

  • ProductionOrder - a Released Production Order (standard items)

If skipped, it is found from documentNo (see How it works > Endpoint). The Document Type is shown in the response.

Sales Orders are not supported.

OPTIONAL

documentNo

string

max 20

The document the whole transaction is produced for:

  • Delivery Agreement - when producing trade items into order. The output trade items will be automatically reserved on this agreement.

  • Released Production Order - when producing standard items. The output is posted on the Production Order.

If documentType is not given, the endpoint gives an error if no document with this number is found. If documentType is given, the document is first checked when the transaction is processed.

The number of a Sales Order is refused (error in the response).

When adding a line to a current Transaction, the documentNo is not necessary, because it has already been put on the transaction. But if it is given, it must match the document number on the transaction.

OPTIONAL

reserveToDocType

string

enum

Used when the produced trade items of this line are to be reserved directly to a Delivery Agreement: SalesAgreement.

If documentNo is a Delivery Agreement, this property is automatically populated on the transaction line and can therefore be skipped. See examples below.

SalesOrder is not supported (error in the response).

OPTIONAL

reserveToDocNo

string

max 20

Used with the field above, the number of the Delivery Agreement.

If documentNo is a Delivery Agreement, this property is automatically populated on the transaction line and can therefore be skipped.

OPTIONAL

reserveToLineNo

integer


Used with the field above, the number of the agreement line, if needed. If not given, the system will find a matching line.

OPTIONAL

lastModified

date-time utc


The system populates this value automatically.

non-editable


Example Object

Expand to see the example json

An example of one object :

JSON
{
    "systemId": "76f12af1-d80c-f111-b02e-c90982a94d21",
    "transactionId": 74,
    "lineNo": 1,
    "terminal": "INNOVA",
    "externalReference": "PROD-06",
    "lot": "LOT005",
    "productionDate": "2026-02-18",
    "itemNo": "70079",
    "quantity": 10,
    "unitOfMeasure": "BOX",
    "weight": 10,
    "pieces": 0,
    "tradeItemBarcode": "",
    "palletBarcode": "",
    "palletNo": "",
    "documentType": "SalesAgreement",
    "documentNo": "DA-0125",
    "lastModified": "2026-02-18T14:48:53.38Z"
}

Usage

The requests below are sent to .../api/wisefish/base/v1.0/companies({companyId})/mesOutput, shortened to .../mesOutput.

Create an output transaction for a single item

Using an “External Reference” that does not exist on an existing transaction, will result in the creation of a new Transaction.

In the following example, an output is posted for 20 boxes on a single pallet that is to be produced for a sales agreement:

JSON
POST
.../mesOutput

Body:
{   
    "terminal": "INNOVA",
    "externalReference": "PROD-09",    
    "productionDate": "2026-02-18",    
    "itemNo": "70079",
    "documentNo": "DS-056",
    "lot": "02-18-001",
    "quantity": 20,
    "unitOfMeasure": "BOX",
    "palletNo": "33230",
    "palletBarcode": "00137300000002332307"
}

The response will show all the properties of the endpoint:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/mesOutput/$entity",
    "@odata.etag": "W/\"JzIwOzExMzk0MDU5NDkyNTA2MTcwNTE5MTswMDsn\"",
    "systemId": "9efafa9f-870d-f111-b02e-ed7e9281a12c",
    "transactionId": 79,
    "lineNo": 1,
    "terminal": "INNOVA",
    "externalReference": "PROD-09",
    "documentType": "SalesAgreement",
    "documentNo": "DS-056",
    "productionDate": "2026-02-18",
    "itemNo": "70079",
    "quantity": 20,
    "unitOfMeasure": "BOX",
    "weight": 20,
    "pieces": 0,
    "lot": "02-18-001",
    "tradeItemBarcode": "",
    "palletBarcode": "00137300000002332307",
    "palletNo": "33230",
    "lastModified": "2026-02-19T11:39:19.21Z"
}
  • The primary key of the created transaction can be seen in property transactionId

  • The primary key of the transaction line is in 2 properties: transactionId and lineNo

  • lineNo has value 1, which means that this is the first item line for this transaction.

  • documentType was found from documentNo: DS-056 is a Delivery Agreement, so the trade items will be reserved to it.


Add trade item to an existing output transaction

Using Transaction ID

Posting again, with the transactionId just created, will add a new line on the same transaction.

JSON
POST
.../mesOutput

{   
    "transactionId": 79,
    "itemNo": "70079",
    "lot": "02-18-001",
    "quantity": 10,
    "unitOfMeasure": "BOX",
    "palletNo": "33230",
    "palletBarcode": "00137300000002332307"
}

The response shows that line number 2 has now been added:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/mesOutput/$entity",
    "@odata.etag": "W/\"JzE5OzI0OTY0MTczNDQ4MTcxNDkxOTExOzAwOyc=\"",
    "systemId": "1ccf7c0c-880d-f111-b02e-ed7e9281a12c",
    "transactionId": 79,
    "lineNo": 2,
    "terminal": "INNOVA",
    "externalReference": "PROD-09",
    "documentType": "SalesAgreement",
    "documentNo": "DS-056",
    "productionDate": "2026-02-18",
    "itemNo": "70079",
    "quantity": 10,
    "unitOfMeasure": "BOX",
    "weight": 10,
    "pieces": 0,
    "lot": "02-18-001",
    "tradeItemBarcode": "",
    "palletBarcode": "00137300000002332307",
    "palletNo": "33230",
    "lastModified": "2026-02-19T11:42:21.143Z"
}

Then the transaction looks like this, because it has 2 item lines:

ADD SNAPSHOT OF page in BC


Using External Reference

In a similar way, the same externalReference can be used repeatedly, to add multiple lines on the same transaction. There is an example of this in documentation API - MES Receipt.


Packages on same Pallet

Putting 2 packages on the same pallet, could be done in the following way:

JSON
POST
.../mesOutput

Create a transaction for every package, by putting the package ID into externalReference
{
    "terminal": "INNOVA",
    "externalReference": "5145",
    "productionDate": "2025-12-12",
    "itemNo": "112600",
    "quantity": 1,
    "unitOfMeasure": "PACK",
    "weight": 25,
    "lot": "2025-12-12",
    "palletBarcode": "00137300000002332307",
    "palletNo": "S099000"
}
Then for next package, repeat this but with another "externalReference":
{
    "terminal": "INNOVA",
    "externalReference": "5146",
    "productionDate": "2025-12-12",
    "itemNo": "112600",
    "quantity": 1,
    "unitOfMeasure": "PACK",
    "weight": 25,
    "lot": "2025-12-12",
    "palletBarcode": "00137300000002332307",
    "palletNo": "S099000"
}

=> A transaction with one item line will be created for every pack


Another way would be to accumulate the whole pallet into one entry:

  • identify the transaction by putting the pallet number into externalReference

  • send in each package identity in the tradeItemBarcode:

JSON
POST
.../mesOutput

{
    "terminal": "INNOVA",
    "externalReference": "S099000",
    "productionDate": "2025-12-12",
    "itemNo": "112600",
    "quantity": 1,
    "unitOfMeasure": "PACK",
    "weight": 25,
    "lot": "2025-12-12",
    "tradeItemBarcode": "5145",
    "palletBarcode": "00137300000002332307",
    "palletNo": "S099000"
}
{
    "terminal": "INNOVA",
    "externalReference": "S099000",
    "productionDate": "2025-12-12",
    "itemNo": "112600",
    "quantity": 1,
    "unitOfMeasure": "PACK",
    "weight": 25,
    "lot": "2025-12-12",
    "tradeItemBarcode": "5146",
    "palletBarcode": "00137300000002332307",
    "palletNo": "S099000"
}


Reserving production for sales

Create an output and instantly reserve to a Delivery Agreement

Using the “reserve to” properties will instantly reserve the trade item after creation.

In the following example, an output is posted for 1 pallet with 32 boxes, and reserved to a Delivery Agreement:

JSON
POST
.../mesOutput

Body:
{   
    "terminal": "INNOVA",
    "externalReference": "PROD-10",    
    "productionDate": "2026-03-13",    
    "itemNo": "70079",
    "lot": "13-03-01",
    "quantity": 32,
    "unitOfMeasure": "BOX",
    "palletNo": "33251",
    "palletBarcode": "00137300000002332510",
    "reserveToDocType": "SalesAgreement",
    "reserveToDocNo": "DA-001"
}


Create an output and reserve multiple items on the same Delivery Agreement

In this example documentNo is used instead of reserveToDocNo - with same results.

JSON
POST
.../mesOutput

Create first entry and there give
- the Delivery Agreement in documentNo:
- the pallet

Body:
{   
    "externalReference": "0106-03",
    "productionDate": "2026-05-31",    
    "itemNo": "70061-2",
    "lot": "PROD-0106",
    "quantity": 30,
    "unitOfMeasure": "BOKS",
    "tradeItemBarcode" : "ITEM-1",
    "palletNo": "33251",
    "palletBarcode": "00137300000002332510",
    "documentNo": "DA-011"  
}

Send another request for same reference and lot, to add another package,
- the document can be skipped, because it is the same for all packages in the same transaction
- use the same pallet barcode
{   
    "externalReference": "0106-03",
    "lot": "PROD-0106",
    "itemNo": "70061-2",
    "quantity": 30,
    "unitOfMeasure": "BOKS",
    "tradeItemBarcode" : "ITEM-2",
    "palletNo": "33251",
    "palletBarcode": "00137300000002332510"
}

To add the third barcoded package, only change the tradeItemBarcode:
{   
    "externalReference": "0106-03",
    "lot": "PROD-0106",
    "itemNo": "70061-2",
    "quantity": 30,
    "unitOfMeasure": "BOKS",
    "tradeItemBarcode" : "ITEM-3",
    "palletNo": "33251",
    "palletBarcode": "00137300000002332510"
}


Output of standard items on a Production Order

Standard items (BC items, not trade items) are output on a Released Production Order. The documentNo is the Production Order No. (documentType can be skipped), and each line must be for an item on the order. In this example 10 PCS of item 1000 are output on lot 2026-11-03:

JSON
POST
.../mesOutput

{
    "terminal": "INNOVA",
    "externalReference": "PO-101003",
    "productionDate": "2026-11-03",
    "documentNo": "101003",
    "itemNo": "1000",
    "lot": "2026-11-03",
    "quantity": 10,
    "unitOfMeasure": "PCS"
}

The response shows "documentType": "ProductionOrder".


How it works

POST → the transaction is created with status Ready (or On Hold) → the job queue error checks it → and posts it → status Processed.
If anything is wrong, the status is Error and nothing is changed in BC. The error can be fixed and the transaction processed again.

  • Nothing is changed in BC (no lots, pallets, trade items or item ledger entries) until the transaction has been processed.

  • Output can only be reserved to Delivery Agreements. Sales Orders are refused.

  • Production Agreements are not supported for output yet.

Endpoint

Each POST creates one line in table MES Transaction Line with Transaction Type = Output, and the response is returned immediately.

Header (MES Transaction)

The line is added to an existing transaction header, or a new header is created:

  • If transactionId is given, the line is added to that transaction. It must exist.

  • Else, if a transaction with the same terminal + externalReference exists, the line is added to it.

  • Else a new transaction header is created.

When a line is added to an existing transaction, the transaction must not be Processed yet, and a given terminal, externalReference, documentNo and lot must match the transaction.

Default values on a new header:

Field

Value

Type

Output

Terminal

terminal, or the default terminal

Activity Date

productionDate, or today

Lot

lot of the first line

Document Type

Only if documentNo is given: documentType, or if not given, found from documentNo in this order:

  1. a Delivery Agreement with this number exists → Sales Agreement

  2. a Sales Order with this number exists → refused (error in the response)

  3. a Released Production Order with this number exists → Production Order

  4. a Production Agreement with this number exists → Production Agreement (gives an error when processed)

Location

Terminal Production Location, else User Profile. The location on each line is used for posting, so a transaction can have lines with different locations.

Stock Center

From the Lot, else Terminal Default Stock Center, else User Profile

Stage

Lot Processing Stage, else Terminal Production Stage, else User Profile. This becomes the stage of the trade items.

Status

Ready, or On Hold if MES Terminal Control says output from this terminal/location is processed manually

Credit

Set when a line has a negative quantity

Line (MES Transaction Line)

Default values on the line, if not given in the request:

Field

Value

Line No.

The next line number of the transaction

Lot

From the header

Location

From the header

Reserve to Doc. Type / No.

From the header, if documentNo is a Delivery Agreement

Item No.

Mapped to the BC item number, if Data Mapping is active

Unit of Measure

If quantity is given without a unit and the Terminal has Populate Unit Automatically: the trade item unit (trade items) or base unit (standard items)

Weight Unit of Measure

The item's weight unit, if weight is given without a unit

Pallet No.

From the pallet, if the pallet with palletBarcode exists

Errors in the response (nothing is created)

  • itemNo is missing

  • the terminal does not exist

  • externalReference is missing, or has already been used for another transaction from the same terminal (also archived transactions). Not checked if the Terminal has Disable Ext. Reference Check.

  • no Location (neither a default nor given)

  • lot is missing

  • documentNo is given without documentType, but no document is found with this number

  • documentNo is a Sales Order, or reserveToDocType is SalesOrder

Everything else is checked when the transaction is processed.

Processing

The MES processor (job queue) processes Ready transactions: first the error check, then the posting. Everything for one transaction is done in one unit: if anything fails, nothing is changed in BC, and the job queue continues with the next transaction.

Errors on the transaction (status Error, nothing posted)

  • Items: trade items (Wisefish products and WIP) are output on lots, without a document or with a Delivery Agreement. Standard items are output on a Released Production Order. A standard item without a Production Order, or a trade item on a Production Order, gives an error. Raw material cannot be output. A transaction cannot have both trade items and standard items.

  • Trade items must have a Net Weight (and a Default Piece Count for some packing methods).

  • Lot: must exist in BC, unless the Terminal has Production Lot Created in MES (then the lot is created). The lot must be a production lot, on the same Stock Center as the transaction. If the Stock Center has Only Active Lots in Production, the lot must be active. If the lot has Unique Production Day, the production date must be the lot's production date.

  • Stage: required.

  • Quantity: quantity without unit, or weight without weight unit, gives an error. Irregular items: the number of trade items must come with a weight.

  • Pallet: must exist, unless the Terminal has Pallets Created in MES (then barcode and pallet no. are required). The pallet must be on the same stock center and location, and open.

  • Reservation: only to Delivery Agreements. The agreement must exist and have the same location. The line is reserveToLineNo, or a matching line is found. If no line is found: error, unless the Terminal has Create missing Sales Lines. With Sales Line No. is Mandatory, reserveToLineNo is required.

  • Production Order: must exist and be Released. Each line must match a line on the order for the item, with the same unit, and the same location if the order line has one. The Inventory Posting Setup needs a WIP Account.

  • Credit: the lot must exist, and the trade item must have at least the quantity to credit.

Result (after posting)

Trade items

  • The lot is created if it does not exist, or opened if it is closed. If an uncertified item is produced on a certified lot, the lot becomes uncertified.

  • A new pallet from MES is created.

  • For each line, a trade item is posted (trade item journal, entry type Output) on the lot, with the stage, location, pallet, trade item barcode, pieces and expiration date:

    • Regular items: quantity in the trade item unit, base unit or another unit; or only weight.

    • Irregular items: quantity in the base unit = one trade item with that weight; or quantity = number of trade items, with weight.

  • Trade items put on a pallet that is already reserved, get the same reservation.

Reservation to a Delivery Agreement

  • The trade items are reserved to the agreement line (reserveToLineNo, or a matching line). A missing line is created, if the Terminal has Create missing Sales Lines.

  • If the Terminal has Sync Quantity and Reserved = After every transaction, the agreement's quantities are updated to the reserved quantity.

Standard items on a Production Order

  • For each line, output is posted on the Production Order line for the item (item journal, entry type Output), with the quantity and unit of the line, on the line's location. For lot tracked items, lot is the lot no. of the output.

  • The posting uses the Production Journal batch of the user, like the Production Journal page in BC. The Document No. is the Production Order No., or the next number from the batch's No. Series if it has one.

Credit (negative quantity)

  • One trade item on the lot is reduced by the credited quantity. Reserved trade items can only be credited if Trade Item Setup has Allow to credit Reserved TIs.

The transaction gets status Processed.

The exact behaviour is described by the unit tests: MES Unit Tests - Output

Settings

Settings that change what happens in the endpoint or in processing:

Setting

Where

Step

Effect

Production Location, Production Stage, Default Stock Center

MES Terminal

Endpoint

Default values on the transaction header

Disable Ext. Reference Check

MES Terminal

Endpoint

externalReference is not required and not checked for uniqueness

Populate Unit Automatically

MES Terminal

Endpoint

Missing unitOfMeasure is taken from the item

Process Manually

MES Terminal Control

Endpoint

New transactions get status On Hold and are not processed by the job queue

Production Lot Created in MES

MES Terminal

Processing

On: an unknown lot is created. Off: the lot must exist in BC.

Pallets Created in MES

MES Terminal

Processing

On: an unknown pallet is created (pallet barcode and pallet no. required). Off: the pallet must exist.

Create missing Sales Lines

MES Terminal

Processing

Reservation: a missing agreement line is created instead of an error

Sales Line No. is Mandatory

MES Terminal

Processing

Reservation: reserveToLineNo is required

Sync Quantity and Reserved

MES Terminal

Processing

After every transaction: the Delivery Agreement's quantities are updated to the reserved quantity

Trade Item Barcode Unique

MES Terminal

Processing

A given tradeItemBarcode must not exist already

Only Active Lots in Production

Stock Center

Processing

Output only on lots that are active in production

Unique Production Day

Lot

Processing

The production date must be the lot's production date

Allow to credit Reserved TIs

Trade Item Setup

Processing

Credit: reserved trade items can also be credited

WIP Account

Inventory Posting Setup

Processing

Required for output of standard items on Production Orders

No. Series

Production Journal batch

Processing

Production Orders: if set, the Document No. comes from it; else it is the Production Order No.