MKG API Productielocaties

Dit artikel bevat de veelgebruikte API-aanroepen voor Productielocaties.

Getest op API V3 en MKG Versie 005.91.014.


Inhoudsopgave


Data dictionary
Voor informatie over endpoints, velden en acties, zie dit artikel.

 

Stappenplan

Om met productielocaties te werken, doorloop je een aantal vaste stappen die samen het volledige proces vormen. Deze stappen zorgen ervoor dat productielocaties op de juiste manier worden gebruikt binnen MKG, zodat planning, urenregistratie en verplaatsingen correct worden verwerkt.
Er zijn twee manieren om materiaal op een productielocatie te leggen:

1. Via de Shop Floor.

2. Via de API tijdens het boeken van uren.

De productielocaties hebben verschillende statussen; deze zijn als volgt:

  • 0: Neutraal (ligt te wachten)
  • 1: Moet opgehaald worden (ligt in de weg)
  • 2: Is neergelegd (ligt klaar voor gebruik)

Startsituatie

Voordat je aan de slag gaat met productielocaties is het belangrijk dat een aantal basisstappen al zijn uitgevoerd en dat je bekend bent met de relevante onderdelen binnen MKG. Bij het gebruik van productielocaties gaan we ervan uit dat de administratie-instellingen zijn ingericht, een productieorder bestaat en dat deze ook is ingepland. Hieronder vind je twee kennisitems die nodig zijn om goed te kunnen werken met productielocaties.

Productie
Voor de calls van de productieorder en orderregel, zie dit artikel.

 

Administratie-instelling
Om met productielocaties te kunnen werken, moet MKG goed ingericht te zijn. Om te bekijken wat je hiervoor moet doen, zie dit artikel.

 

Ophaallijst ophalen

Voor het ophalen van alle productie-items die momenteel op de ophaallijst staan, kan gebruik worden gemaakt van de onderstaande API-call. De ophaallijst kijkt alleen naar de status 'Moet opgehaald worden'.

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

 

Neerleglijst ophalen

Voor het ophalen van alle productie-items die momenteel op de neerleglijst staan, kan gebruik worden gemaakt van de onderstaande API-call. De neerleglijst kijkt naar alles wat niet de status 'Is neergelegd' heeft en heeft een peildatum nodig om het bereik te bepalen.

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

 

Uren boeken

Voor het registreren van gewerkte uren op de productieorderregel kan gebruik worden gemaakt van de onderstaande API-call. Hiermee worden de geboekte uren vastgelegd binnen de planning, zodat je de voortgang kunt bijhouden. 

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}}", // nieuw veld 1 en vereist, moet actief zijn op shopfloor anders is de locatie niet geldig.
                    "t_magl_aantal": 1 , // nieuw veld 2 en vereist
                    "t_loc_oms": "Productie locatie in 001",  // nieuw veld 3
                    "t_loc_id": "PL001", // nieuw veld 4
                    "t_loc_status": 1,  // nieuw veld 5
                    "prdl_datum": "{{TodayReverse}}"
                }
            ]
        }
    }
}

 

Verplaatsen naar productielocatie

Voor het veplaatsen van de locatie waarop een productieorderregel wordt uitgevoerd, kan gebruik worden gemaakt van de onderstaande API-call. Hiermee kan de productieorderregel worden verplaatst naar een andere productielocatie:

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
                }
            ]
        }
    }
}

 

Historisch maken productielocatie

Voor het historisch maken van een productie-item kan gebruik worden gemaakt van de onderstaande API-call. Hiermee wordt het item afgesloten en verplaatst naar het historisch overzicht, zodat de afgeronde productiegegevens bewaard blijven voor rapportage en naslag.

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
                }
            ]
        }
    }
}