Stock Movements

Context of use

The webservices described below relate to the management of stock movements used in MES Operations. Stock movements include all movements affecting the stock level, whether they have been triggered by manufacturing (consumption, production) or miscellaneous movements (inputs, outputs, transfers,…​)

Theses webservices can be used for example in the case where stock management is shared between the MES and other software (ERP, WMS…​). In certain simple cases, stock movements can be used to manage entries on MO (Manufacturing Orders).

For the entity "Stock Movements", one operation is available :

  • Get a paginated list of stock movements

Endpoints

Get stock movements

Description

This endpoint allows to get a list of stock movements by selecting a range of last modification dates (from / to). The end limit is not compulsory ; in a normal use context, where all modifications are expected, the selection relates only to the start date (all movements since…​). However, in the case of data recovery for a certain period of time, the use of the date range is possible.

/companies/{companycode}/establishments/{establishmentcode}/stock-movements

Parameters

Type Name Description Schema Associated rules

Path

companyCode
required

Current context company code

string

Path

establishmentCode
required

Current context establishment code

string

Query

page
required

Page index

int

Query

size
required

Entity count per page

int

Query

from
required

Movement created, updated or deleted since

datetime (ISO-8601)

R1

Query

to
optional

To get a range in the past : Movement created, updated or deleted since / to

datetime (ISO-8601)

R1

Query

natureCodes
optional

Filter on natures

list<string>

R2

Query

depotCodes
optional

Filter on depots

list<string>

R3

Rules

R1

If from and to are both set, from should be before to.

R2

NatureCodes : list of the natures to get. The list can include manufacturing natures (MO_IN and MO_OUT) and natures of miscellaneous movements. If the list of natures is empty, all the movements, whatever their nature, will be get.

R3

DepotCodes : list of depots to get. If the list of depots is empty, all the movements, whatever their depot, will be get.

Responses

HTTP Code Description Schema

201

Successfully created

400

Functionnal error

No Content

500

Internal server error

No Content

Consumes

  • application/json

Produces

  • application/json

Data structure

PaginatedList<StockMovement>

Description of a pagined list of stock movements

Name Description Value Associated rules

paging
required

Paging

data
required

List of stock movements

StockMovement

Description of a stock movement

Name Description Value Associated rules

companyCode
required

Company code

string

establishmentCode
required

Establishment code

string

action
required

Specify if it’s a creation, an update or a deletion

string (CREATE, UPDATE, DELETE)

R4

movementDate
required

Date of taking into account the input in stock

datetime (ISO-8601)

lastModifiedDate
required

Date of last modification (creation, update, or deletion) ; it’s the reference date of "from-to" filter

datetime (ISO-8601)

direction
required

Specify if it’s an input or output movement

string (INPUT, OUTPUT)

natureCode
required

nature code

string

R5

itemBatchQuantities
required

Detail of the material moved

container
optional

Informations about container

localisation
required

Geographical origin or destination of the movement

movementId
required

Unique movement reference. Identical value for all movements of the same action.

long

domain
required

Initiating function domain

string (MANUFACTURING, MISCELLEANOUS_MOVEMENT)

domainInfos
optional

Specific information of initiating function (MO Number, …)

DomainInfos

Content depends on "domain", i.e on the function with triggered the stock movement.

If domain = "MANUFACTURING"

Name Description Value Associated rules

moNbExt
optional

External mo number. Can be a string or a number

string

moNb
required

Internal Vif mo number

string

Rules

R4

If a stock movement is modified in the MES (e.g.: modification of a quantity on a miscellaneous movement), 2 movements are created:

  • a CANCEL movement of the old value

  • a REPLACE movement with the new

R5

If the stock movement has been triggered by the domain "manufact", the natureCode will be a nature code managed by MES, as following :

  • manufacturing input (stock output) : nature code is MO_IN

  • manufacturing output (stock input) : nature code is MO_OUT

If the stock movement has been triggered by a miscellaneous movement, the nature will be the nature of the miscellaneous movement used by the operator.