MKG API Production Locations

This article contains the frequently used API calls for Production Locations.

Tested on API V3 and MKG Version 005.91.014.


Table of Contents


Data Dictionary
For information on endpoints, fields, and actions, see this article.

 

Step-by-step plan

To work with production locations, you follow a number of fixed steps that together form the complete process. These steps ensure that production locations are used correctly within MKG, so that planning, time registration, and movements are processed correctly.
There are two ways to place material at a production location:

1. Via the Shop Floor.

2. Via the API during time logging.

Production locations have different statuses; they are as follows:

  • 0: Neutral (waiting)
  • 1: Needs to be picked up (in the way)
  • 2: Has been deposited (ready for use)

Initial situation

Before you start working with production locations, it is important that some basic steps have already been completed and that you are familiar with the relevant components within MKG. When using production locations, we assume that the administrative settings are configured, a production order exists, and it is also scheduled. Below are two knowledge items needed to work effectively with production locations.

Production
For the calls of the production order and order line, see this article.

 

Administrative Setting
To work with production locations, MKG must be properly configured. To see what you need to do for this, see this article.

 

Retrieve pick-up list

To retrieve all production items currently on the pick-up list, the API call below can be used. The pick-up list only looks at the status 'Needs to be picked up'.

GET {{restUrl}}/Documents/Company/0/company_prdl?Filter=prdl_actief = true AND prdl_status=1&FieldList=admi_num,prdl_actief,prdh_num,prdr_num,prbv_num,plnb_num,prdl_id,magl_code,prdl_aantal,prdl_status

{{restUrl}}/Documents/Company/0/company_prdl?Filter=prdl_actief = true AND prdl_status=1&FieldList=admi_num,prdl_actief,prdh_num,prdr_num,prbv_num,plnb_num,prdl_id,magl_code,prdl_aantal,prdl_status

 

Retrieve deposit list

To retrieve all production items currently on the deposit list, the API call below can be used. The deposit list looks at everything that does not have the status 'Has been deposited' and requires a reference date to determine the range.

GET {{restUrl}}/Documents/Company/0/company_prdl?Filter=prdl_actief = true AND t_peildatum=19-11-2025 AND prdl_status<>2&FieldList=admi_num,prdl_actief,prdh_num,prdr_num,prbv_num,plnb_num,prdl_id,magl_code,prdl_aantal,prdl_status

{{restUrl}}/Documents/Company/0/company_prdl?Filter=prdl_actief = true AND t_peildatum=19-11-2025 AND prdl_status<>2&FieldList=admi_num,prdl_actief,prdh_num,prdr_num,prbv_num,plnb_num,prdl_id,magl_code,prdl_aantal,prdl_status

 

Log hours

To register worked hours on the production order line, the API call below can be used. This records the logged hours within the planning, allowing you to track progress. 

POST {{restUrl}}/Documents/uren

{{restUrl}}/Documents/uren

Request body:

{
    "request": {
        "InputData": {
            "uren": [
                {
                    "admi_num": 1,
                    "uren_begin_eind": 1,
                    "medw_num": "{{medw_num}}",
                    "uren_datum": "{{TodayReverse}}",
                    "uren_datum_van": "{{TodayReverse}}",
                    "uren_tijd_van": 30600,
                    "uren_datum_mach_van": "{{TodayReverse}}",
                    "uren_tijd_mach_van": 30600,
                    "bwrk_num": {{bwrk_num}}, 
                    "prdh_num": "{{prdhnum}}", 
                    "prdr_num": "{{prdrnum}}",
                    "plnb_num": "{{plnb_num}}",
                    "uren_reservekopie": false,
                    "t_magl": "{{magl_code}}", // new field 1 and required, must be active on shopfloor otherwise the location is not valid.
                    "t_magl_aantal": 1 , // new field 2 and required
                    "t_loc_oms": "Production location in 001",  // new field 3
                    "t_loc_id": "PL001", // new field 4
                    "t_loc_status": 1,  // new field 5
                    "prdl_datum": "{{TodayReverse}}"
                }
            ]
        }
    }
}

 

Move to production location

To move the location where a production order line is executed, the API call below can be used. This allows the production order line to be moved to another production location:

PUT {{restUrl}}/Documents/prdl/0/Service/s_move

{{restUrl}}/Documents/prdl/0/Service/s_move

Request body:

{
    "request": {
        "InputData": {
            "prdl": [
                { 
                 // Below are sample values, These are all mandatory fields for it to work correctly.
                 // The first set composes the production order on which the production location is modified or moved.
                "admi_num" : 1         // The administration number from MKG on which the PUT request is executed.
                "prdh_num" : 60230707,     // The production order number whose production location is to be updated.
                "prdr_num" : 1,        // The production order line number whose production location is to be updated.
                "prbv_num" : 1,        // The production order line operation whose production location is to be updated.
                "plnb_num" : 1,        // The production order line planning operation whose production location is to be updated.
    
                // The second set consists of the values of the rule you want to modify.
                "t_id_old": "",        // The production location ID of the current rule.
                "prdl_actief" : true,    // The current rule must be active to modify it.
                "t_locatie_old": "1000in",    // Production location of the current rule.
                "prdl_status": 1,        // The current production order location status. This status must be 1 of the following values 0 (neutral), 1(has to be picked up) or 2 (Has been deposited). 
    
                 // The third set consists of the values after which the production location should be adjusted to for changing.
                "t_actief_new": true,    // The new rule must be active. If set to false then the it will make the rule historical and unavailable in MKG. A different service is used for this purpose. 
                "t_aantal_new": 1000,    // The amount you are going to change it to.
              "t_locatie_new": "1000uit",    // The new production location of the amount you will change. 
                "t_status_new": 1,               // The new status that the production location should be in if it has been moved or changed. This status value must be 0 (neutral), 1(has to be picked up) or 2 (Has been deposited).
                "RowKey": 1                       // Fixed value, do not remove
                }
            ]
        }
    }
}

 

Make production location historical

To make a production item historical, the API call below can be used. This closes the item and moves it to the historical overview, so that completed production data is preserved for reporting and reference.

PUT {{restUrl}}/Documents/uren

{{restUrl}}/Documents/uren

Request body:

{
    "request": {
        "InputData": {
            "prdl": [
                {
                    "admi_num": 1, // Administration
                    "prdh_num": "60250041", // Production order
                    "prdr_num": 1, // Production order sub-assemblies
                    "prbv_num": 1, // Operation VC
                    "plnb_num": 1, // Edit schedule. Not mandatory, when empty put down quotes.
                    "magl_code": "PL001", // Warehouse location. Not mandatory, when empty put down quotes.
                    "prdl_id": "", // ID. Not mandatory, put down empty quotes.
                    "prdl_status": 1, // Status. 0 = Neutral, 1 = Should be retrieved, 2 = Has been deposited
                    "RowKey": 1 // Mandatory to provide
                }
            ]
        }
    }
}