This feature is used to issue an order to production. From a received order, we create an issued order, and from that we create a production order. To use this option, you need to have the bill of materials and warehouse mapping correctly configured for the material items.
This feature is only available for issued order records. General documentation for the feature can be found in the application documentation.
URL Construction and URL Parameters
Via the REST API, a production order can be created from an existing issued order using the virtual register objednani and its sub-registers:
pro-vyrobu-zbozireturns the materials required for manufacturing the goods in the given orders
is available at the address
/c/{ID firmy}/objednani/pro-vyrobu-zboziis called using the GET method and requires a filter in the URL that identifies objects from the objednavka-vydana register
returns goods with the following properties:
cenik- the goods to be orderedsklad- the warehouse to which the goods belongjizObjednano- quantity already orderedjizRezervovano- covered reservationsobjednano- quantity to be orderedobjednat- quantity being ordered (this value can be modified before submission)skladem- quantity in stocksklMinimum- minimum stock quantity
pro-vyrobucreates an order for goods from specified suppliers
is available at the address
/c/{ID firmy}/objednani/pro-vyrobuis called using the POST or PUT methods and requires the following:
typDokl- the id or code of an object from the typ-objednavky-vydane registerdodavatel- the id or code of an object from the adresar registerzboziProVyrobu- the list of goods retrieved from theobjednani/pro-vyrobu-zboziregisterrequires a filter in the URL that identifies objects from the objednavka-vydana register
Creating a Production Order Using Packaging
Instead of the element objednat, you can use the element objednatBaleni, in which you can specify quantities in packaging units. You can use one or more types of packaging as defined in the price list identified by the element cenik. Each packaging must contain:
id- identification of the packaging (values 1 to 5)mnozMj- quantity ordered in packaging units (decimal number)
Calling Method
You can use the HTTP method: GET or POST/PUT; the supported output formats are XML or JSON.
The endpoint for calling the service contains the name of the virtual register objednani and the name of its sub-register pro-vyrobu-zbozi or pro-vyrobu:
Retrieving goods
https://localhost:5434/c/{ID firmy}/objednani/(fitrace objednávek)/pro-vyrobu-zbozi.xml (.json).
Creating an order
https://localhost:5434/c/{ID firmy}/objednani/(fitrace objednávek)/pro-vyrobu.xml (.json).
Usage Examples
As mentioned, the call consists of two steps. In the first step, we retrieve the materials needed to manufacture the goods for the selected order. In the next step, we submit this list to create a production order with the specified list of materials.
1. Retrieving the list of materials in XML — the issued order with ID = 123 contains goods KOLO ready for production, which has a specified bill of materials:
GET https://localhost:5434/c/firma_s_r_o_/objednani/(id=123)/pro-vyrobu-zbozi.xml
The API response is a list of materials according to the bill of materials, including the fields specified above:
<?xml version="1.0" ?>
<winstrom>
<zbozi>
<cenik>code:DRÁT</cenik>
<jizObjednano>680.9</jizObjednano>
<jizRezervovano>0.0</jizRezervovano>
<objednano>32.0</objednano>
<objednat>0.0</objednat>
<sklMinimum>0.0</sklMinimum>
<sklad>code:LIBEREC</sklad>
<skladem>49.7</skladem>
</zbozi>
<zbozi>
<cenik>code:STŘED</cenik>
<jizObjednano>0.0</jizObjednano>
<jizRezervovano>0.0</jizRezervovano>
<objednano>1.0</objednano>
<objednat>0.0</objednat>
<sklMinimum>0.0</sklMinimum>
<sklad>code:LIBEREC</sklad>
<skladem>112.0</skladem>
</zbozi>
<zbozi>
<cenik>code:RÁFEK</cenik>
<jizObjednano>0.0</jizObjednano>
<jizRezervovano>0.0</jizRezervovano>
<objednano>1.0</objednano>
<objednat>0.0</objednat>
<sklMinimum>0.0</sklMinimum>
<sklad>code:LIBEREC</sklad>
<skladem>122.0</skladem>
</zbozi>
</winstrom>
2. An equivalent call can be made using JSON:
GET https://localhost:5434/c/firma_s_r_o_/objednani/(id=123)/pro-vyrobu-zbozi.json
The API response is a list of materials according to the bill of materials, including the fields specified above, in JSON format:
{
"winstrom": {
"zbozi": [
{
"cenik": "code:DRÁT",
"jizObjednano": "685.9",
"jizRezervovano": "0.0",
"objednano": "32.0",
"objednat": "0.0",
"sklMinimum": "0.0",
"sklad": "code:LIBEREC",
"skladem": "49.7"
},
{
"cenik": "code:STŘED",
"jizObjednano": "10.0",
"jizRezervovano": "0.0",
"objednano": "1.0",
"objednat": "0.0",
"sklMinimum": "0.0",
"sklad": "code:LIBEREC",
"skladem": "112.0"
},
{
"cenik": "code:RÁFEK",
"jizObjednano": "10.0",
"jizRezervovano": "0.0",
"objednano": "1.0",
"objednat": "0.0",
"sklMinimum": "0.0",
"sklad": "code:LIBEREC",
"skladem": "122.0"
}
]
}
}
3. The retrieved list of materials, with any adjustments to the order quantity field, is submitted as the request body to create a production order:
POST https://localhost:5434/c/firma_s_r_o_/objednani/(id=123)/pro-vyrobu.xml
Request body:
<?xml version="1.0" ?>
<winstrom>
<objednaniProVyrobu>
<typDokl>code:VYROBA</typDokl>
<dodavatel>code:SIGNA</dodavatel>
<zboziProVyrobu>
<zbozi>
<cenik>code:DRÁT</cenik>
<jizObjednano>680.9</jizObjednano>
<jizRezervovano>0.0</jizRezervovano>
<objednano>32.0</objednano>
<objednat>5.0</objednat>
<sklMinimum>0.0</sklMinimum>
<sklad>code:LIBEREC</sklad>
<skladem>49.7</skladem>
</zbozi>
<zbozi>
<cenik>code:STŘED</cenik>
<jizObjednano>0.0</jizObjednano>
<jizRezervovano>0.0</jizRezervovano>
<objednano>1.0</objednano>
<objednat>10.0</objednat>
<sklMinimum>0.0</sklMinimum>
<sklad>code:LIBEREC</sklad>
<skladem>112.0</skladem>
</zbozi>
<zbozi>
<cenik>code:RÁFEK</cenik>
<jizObjednano>0.0</jizObjednano>
<jizRezervovano>0.0</jizRezervovano>
<objednano>1.0</objednano>
<objednat>10.0</objednat>
<sklMinimum>0.0</sklMinimum>
<sklad>code:LIBEREC</sklad>
<skladem>122.0</skladem>
</zbozi>
</zboziProVyrobu>
</objednaniProVyrobu>
</winstrom>
Upon successful creation, the response returns HTTP status code 201 Created along with the identifiers of the created issued orders:
<?xml version="1.0" encoding="utf-8"?>
<winstrom version="1.0">
<success>true</success>
<stats>
<created>1</created>
<updated>0</updated>
<deleted>0</deleted>
<skipped>0</skipped>
<failed>0</failed>
</stats>
<results>
<result>
<id>363</id>
</result>
</results>
</winstrom>
4. Ordering materials from multiple suppliers is also supported, as is the JSON format:
POST https://localhost:5434/c/firma_s_r_o_/objednani/(id=123)/pro-vyrobu.json
Request body:
{
"winstrom": {
"objednaniProVyrobu": [
{
"typDokl": "code:OBV",
"dodavatel": "code:DODAVATEL-A",
"zboziProVyrobu": {
"zbozi": {
"cenik": "5",
"sklad": "4",
"jizObjednano": "0.0",
"jizRezervovano": "0.0",
"objednano": "10.0",
"objednat": "10.0",
"sklMinimum": "0.0",
"skladem": "0.0"
}
}
},
{
"typDokl": "code:OBV",
"dodavatel": "code:DODAVATEL-B",
"zboziProVyrobu": {
"zbozi": {
"cenik": "6",
"sklad": "4",
"jizObjednano": "0.0",
"jizRezervovano": "0.0",
"objednano": "20.0",
"objednat": "20.0",
"sklMinimum": "0.0",
"skladem": "0.0"
}
}
}
],
"_version": "1.0"
}
}
5. Ordering packaging units in JSON. For example, if we have packaging with id 1 containing two items and packaging with id 2 containing four items, the following request can be used to order 10 units of goods.
POST https://localhost:5434/c/firma_s_r_o_/objednani/(id=123)/pro-vyrobu.json
Request body:
{
"winstrom": {
"objednaniProVyrobu": {
"typDokl": "code:OBV",
"dodavatel": "code:DODAVATEL-A",
"zboziProVyrobu": {
"zbozi": {
"cenik": "5",
"sklad": "4",
"jizObjednano": "0.0",
"jizRezervovano": "0.0",
"objednano": "10.0",
"objednatBaleni": {
"baleni": [
{
"id": "1",
"mnozMj": "1.0"
},
{
"id": "2",
"mnozMj": "2.0"
}
]
},
"sklMinimum": "0.0",
"skladem": "0.0"
}
}
},
"@version": "1.0"
}
}
Failed Requests
1. Incorrect use of HTTP methods — for example, sending a GET request to the sub-register pro-vyrobu:
The API response is 405 Method not Allowed "success": "false"
2. If the issued order has already been sent to production, or if the order does not contain a goods item with a bill of materials, the API will notify you with the following message:
"message": "Nebyly nalezeny žádné položky vhodné pro objednání."
3. Incorrect submission of a material item for production that does not have a properly configured bill of materials or warehouse mapping.
"message": "Pro položku ceníku 'HRUŠKA' není nastaveno mapování skladů."
4. A syntax error in the request body for the production order — for example, a typo in the element dodavatel, etc.:
"message": "unexpected element (uri:\"\", local:\"doddavatel\"). Expected elements are <{}zboziProVyrobu>,<{}dodavatel>,<{}typDokl>"
Need help?
If you have any questions about the application, please contact us at podporaflexi@abra.eu or via the chat window in the bottom right corner.
