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):
-
Endpoint: the MES posts to the endpoint, and the MES transaction is created. Nothing else is changed in BC yet.
-
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 |
|
|
Source table |
|
|
Fixed view/defaults |
This endpoint will only create/show transactions with Type = Output. |
|
Requests allowed |
|
|
Primary key |
The primary key of a transaction line is |
|
Record ID |
The record ID is |
|
Procedures |
None |
Data
Field List
|
Property |
Type |
Format |
Description |
|
|---|---|---|---|---|
|
|
string |
uuid |
The automatic system ID, which is in GUID format. |
record id non-editable |
|
|
integer |
|
The Transaction this line belongs to.
|
PRIMARY KEY OPTIONAL |
|
|
integer |
|
The sequence number of this line, within the transaction which has ID = |
PRIMARY KEY non-editable |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
string |
date |
Production date for the items. If not given, today. |
OPTIONAL |
|
|
string |
date |
Expiration date for the items. If not given, the system will calculate it automatically. |
OPTIONAL |
|
|
string |
max 10 |
The location of the produced item / trade item. |
OPTIONAL |
|
|
string |
max 20 |
Item No. |
Mandatory |
|
|
decimal |
|
|
Mandatory * |
|
|
string |
max 10 |
The unit of measure that belongs to the |
Mandatory * |
|
|
decimal |
|
Weight, if used, it is the weight in the base weight unit of Wisefish. |
Mandatory * |
|
|
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 |
|
|
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 |
|
|
string |
max 22 |
If given, this will be the Trade Item Barcode on the Trade Item entry. |
OPTIONAL |
|
|
string |
max 20 |
If this trade item was put on a pallet, give the pallet barcode in this property. |
OPTIONAL |
|
|
string |
max 20 |
If the pallet has already been created, this field can be skipped. |
OPTIONAL |
|
|
string |
enum |
The type of the document in
If skipped, it is found from Sales Orders are not supported. |
OPTIONAL |
|
|
string |
max 20 |
The document the whole transaction is produced for:
If The number of a Sales Order is refused (error in the response). When adding a line to a current Transaction, the |
OPTIONAL |
|
|
string |
enum |
Used when the produced trade items of this line are to be reserved directly to a Delivery Agreement: If
|
OPTIONAL |
|
|
string |
max 20 |
Used with the field above, the number of the Delivery Agreement. If |
OPTIONAL |
|
|
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 |
|
|
date-time utc |
|
The system populates this value automatically. |
non-editable |
Example Object
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:
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:
{
"@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:
transactionIdandlineNo -
lineNohas value 1, which means that this is the first item line for this transaction. -
documentTypewas found fromdocumentNo: 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.
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:
{
"@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:
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:
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:
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.
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:
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
transactionIdis given, the line is added to that transaction. It must exist. -
Else, if a transaction with the same
terminal+externalReferenceexists, 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 |
|
|
Activity Date |
|
|
Lot |
|
|
Document Type |
Only if
|
|
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 |
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 |
|
Item No. |
Mapped to the BC item number, if Data Mapping is active |
|
Unit of Measure |
If |
|
Weight Unit of Measure |
The item's weight unit, if |
|
Pallet No. |
From the pallet, if the pallet with |
Errors in the response (nothing is created)
-
itemNois missing -
the terminal does not exist
-
externalReferenceis 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)
-
lotis missing -
documentNois given withoutdocumentType, but no document is found with this number -
documentNois a Sales Order, orreserveToDocTypeisSalesOrder
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,reserveToLineNois 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:
quantityin the trade item unit, base unit or another unit; or onlyweight. -
Irregular items:
quantityin the base unit = one trade item with that weight; orquantity= number of trade items, withweight.
-
-
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,
lotis 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 |
|
|
Populate Unit Automatically |
MES Terminal |
Endpoint |
Missing |
|
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: |
|
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 |
|
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. |