Приклад: кіоск цеху поверх API

ERP, з якої всі даніЩо всередині?

Ви - працівник цеху біля планшета на дільниці. Оберіть себе.

Хто ви

Бойко Наталія СтепанівнаБондаренко Ігор СергійовичГнатів Роман ПетровичДзюба Олег МиколайовичЗахарчук Оксана ТарасівнаКовальчук Андрій ПетровичКравчук Ірина АндріївнаЛисенко Денис ОлександровичЛуцик Богдан ІгоровичМельник Тарас ІгоровичМороз Катерина ЮріївнаПавлів Юрій РомановичПетренко Софія ОлегівнаСавчук Віктор МиколайовичСидорук Марія ВасилівнаТкаченко Василь ГригоровичШевчук Ольга Іванівна

що всередині?

Що всередині?

Що відбувається всередині

2 виклики API, запитів до бази: 0, 789 мс

З чого складається цей екран

  1. Люди цехуGET /api/v1/v/zbirka/peopleЗ кого обрати себе. Ключ із роллю «Виробництво» читає перелік; дію записують на обрану людину.
  2. Робочі місця і чергаGET /api/v1/v/zbirka/floorКожне місце зі станом, чергою і відкритими операціями: один виклик на всю сторінку.
  3. Кнопка «Почати»POST /api/v1/act/zbirka/start_operationЛюдина бере один виріб замовлення в роботу. Поле personId приймає імʼя, не id.
  4. Кнопка «Завершити»POST /api/v1/act/zbirka/finish_operationЗавершує розпочате за його startId; час рахує ERP.

Виклики API цієї сторінки

Назви запитів і таблиць дає сам API. Перевірку ключа і запис у журнал викликів тут не пораховано.

  1. 1опис views319 мс200

    GET /api/v1/views

    Подання, які читає цей ключ, з їхніми параметрами і читаннями

    Опис, який API дає про себе. Тримається в памʼяті десять хвилин.

    показати запит і відповідь
    GET /api/v1/views
    {
      "headers": {
        "authorization": "Bearer <ключ>"
      }
    }
    {
      "views": [
        {
          "module": "people",
          "name": "preview",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "prodazh",
          "name": "deal_stages",
          "readers": [
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant"
          ],
          "about": "The stages of a deal by the rule dealStages. With id: {row: \"deal\"} once, then one {row: \"stage\", stage, state, date, what, n, days, day, of} per stage, left to right. Without id: one {row: \"deal\", ..., stage, state, date, what, ...} per deal that stands, with the first stage something stands in the way of. state: done | now | blocked | wait | stopped. what (null when nothing): not_confirmed | short | components | not_released | unchecked | not_shipped | gift_rule | unsigned | refused | overdue | unsigned_wait | payment_wait; n, days, day and of are its numbers.",
          "title": "Етапи угоди: стан кожного, його день і що заважає",
          "params": [
            {
              "name": "id",
              "description": "Поле id з запиту deals. Порожньо - угоди, що стоять, кожна з етапом, на якому стоїть."
            }
          ],
          "rule": "Правило dealStages (packages/rules/src/deal.ts): етапи рахують із фактів угоди, нічого не зберігають. Стан етапу і те, що йому заважає або чого він чекає, рядок каже кодами, з числами поруч. Без права на суми етап оплати лишається без стану.",
          "reads": [
            {
              "query": "deal",
              "tables": [
                "production_order_need",
                "reservation_held",
                "stock_pool_on_hand",
                "customer_claim",
                "so_line_shipped",
                "document",
                "journal_entry",
                "so_line",
                "production_order",
                "serial_number",
                "qc_unit",
                "document_state",
                "open_item",
                "company_setting",
                "agreement",
                "sales_order",
                "party",
                "request_outcome",
                "request"
              ]
            },
            {
              "query": "deals_standing",
              "tables": [
                "production_order_need",
                "reservation_held",
                "stock_pool_on_hand",
                "customer_claim",
                "so_line_shipped",
                "document",
                "journal_entry",
                "so_line",
                "production_order",
                "serial_number",
                "qc_unit",
                "document_state",
                "open_item",
                "company_setting",
                "agreement",
                "sales_order",
                "party",
                "request_outcome",
                "request"
              ]
            }
          ]
        },
        {
          "module": "dovidnyk",
          "name": "card",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "dovidnyk",
          "name": "glossary",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "dovidnyk",
          "name": "stock_total",
          "readers": [
            "anyone"
          ],
          "fields": {
            "value": [
              "accountant"
            ]
          }
        },
        {
          "module": "dovidnyk",
          "name": "stock",
          "readers": [
            "anyone"
          ],
          "fields": {
            "value": [
              "accountant"
            ]
          }
        },
        {
          "module": "dovidnyk",
          "name": "where_used",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "dovidnyk",
          "name": "spec_versions",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "dovidnyk",
          "name": "purchase_orders",
          "readers": [
            "storekeeper",
            "purchaser",
            "production",
            "accountant"
          ],
          "fields": {
            "price": [
              "purchaser",
              "accountant"
            ]
          }
        },
        {
          "module": "komora",
          "name": "sites",
          "readers": [
            "anyone"
          ],
          "fields": {
            "reserve_value": [
              "accountant"
            ],
            "work_value": [
              "accountant"
            ]
          }
        },
        {
          "module": "komora",
          "name": "site_stock",
          "readers": [
            "anyone"
          ],
          "fields": {
            "value": [
              "accountant"
            ]
          }
        },
        {
          "module": "zbirka",
          "name": "plan",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "zbirka",
          "name": "promise",
          "readers": [
            "viewer",
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant"
          ],
          "title": "Коли можна відвантажити: оцінка терміну для кількості однієї позиції",
          "params": [
            {
              "name": "item",
              "required": true,
              "description": "Артикул позиції або її id."
            },
            {
              "name": "qty",
              "required": true,
              "description": "Кількість, додатне ціле число."
            },
            {
              "name": "needed_by",
              "description": "День, до якого потрібно (РРРР-ММ-ДД). Порожньо - відповідь без порівняння з днем."
            }
          ],
          "rule": "Правило deliveryEstimate (packages/rules/src/promise.ts): план потреби рахують двічі, без цієї кількості і з нею; різниця - що виготовити і що купити. Куповане чекає термін постачальника, виготовлене - чергу і людей робочих місць; дні робочі, з понеділка по пʼятницю.",
          "reads": [
            {
              "query": "mrp_bom_lines",
              "tables": [
                "bom",
                "bom_line"
              ]
            },
            {
              "query": "mrp_demand",
              "tables": [
                "production_order_output",
                "so_line_shipped",
                "so_line",
                "sales_order",
                "production_order",
                "item"
              ]
            },
            {
              "query": "mrp_supply",
              "tables": [
                "reservation_held",
                "po_line_received",
                "stock_balance",
                "po_line",
                "purchase_order",
                "item"
              ]
            },
            {
              "query": "mrp_analogs",
              "tables": [
                "bom",
                "bom_line",
                "bom_substitute",
                "item"
              ]
            },
            {
              "query": "plan_open",
              "tables": [
                "economic_event",
                "journal_entry",
                "production_plan",
                "production_order",
                "production_order_output",
                "item"
              ]
            },
            {
              "query": "promise_routes",
              "tables": [
                "bom",
                "bom_operation",
                "work_center",
                "bom_operation_card"
              ]
            },
            {
              "query": "promise_lead_days",
              "tables": [
                "supplier_price"
              ]
            },
            {
              "query": "floor_plan_orders",
              "tables": [
                "operation_progress",
                "economic_event",
                "journal_entry",
                "operation_live",
                "production_order",
                "item",
                "bom_operation",
                "work_center"
              ]
            },
            {
              "query": "floor_assignments",
              "tables": [
                "work_center_assignment",
                "party",
                "work_center"
              ]
            },
            {
              "query": "item_availability",
              "tables": [
                "reservation_held",
                "stock_pool_on_hand",
                "stock_reserved",
                "item"
              ]
            }
          ]
        },
        {
          "module": "zbirka",
          "name": "order",
          "readers": [
            "viewer",
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant",
            "shop_worker"
          ]
        },
        {
          "module": "zbirka",
          "name": "order_cover",
          "readers": [
            "viewer",
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant"
          ]
        },
        {
          "module": "zbirka",
          "name": "demand",
          "readers": [
            "viewer",
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant"
          ]
        },
        {
          "module": "zbirka",
          "name": "plan_lines",
          "readers": [
            "viewer",
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant"
          ]
        },
        {
          "module": "zbirka",
          "name": "plan_holds",
          "readers": [
            "viewer",
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant"
          ]
        },
        {
          "module": "zbirka",
          "name": "changes",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "zbirka",
          "name": "change",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "zbirka",
          "name": "change_versions",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "zbirka",
          "name": "change_diff",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "zbirka",
          "name": "bom_diff",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "zbirka",
          "name": "products",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "zbirka",
          "name": "how_head",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "zbirka",
          "name": "how_totals",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "zbirka",
          "name": "how_parts",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "zbirka",
          "name": "how_route",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "zbirka",
          "name": "plan_time",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "zbirka",
          "name": "order_time",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "zbirka",
          "name": "floor",
          "readers": [
            "viewer",
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant",
            "shop_worker"
          ],
          "fields": {
            "people": [
              "production",
              "accountant"
            ],
            "people_list": [
              "production",
              "accountant"
            ],
            "shop_line": [
              "viewer",
              "storekeeper",
              "sales",
              "purchaser",
              "production",
              "accountant"
            ],
            "shop_line_status": [
              "viewer",
              "storekeeper",
              "sales",
              "purchaser",
              "production",
              "accountant"
            ]
          }
        },
        {
          "module": "zbirka",
          "name": "floor_line",
          "readers": [
            "viewer",
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant"
          ]
        },
        {
          "module": "zbirka",
          "name": "open_work",
          "readers": [
            "viewer",
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant",
            "shop_worker"
          ]
        },
        {
          "module": "zbirka",
          "name": "order_operations",
          "readers": [
            "viewer",
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant",
            "shop_worker"
          ],
          "fields": {
            "who": [
              "production",
              "accountant"
            ]
          }
        },
        {
          "module": "zbirka",
          "name": "order_records",
          "readers": [
            "viewer",
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant",
            "shop_worker"
          ],
          "fields": {
            "person": [
              "production",
              "accountant"
            ],
            "actor_id": [
              "production",
              "accountant"
            ]
          }
        },
        {
          "module": "zbirka",
          "name": "workplace_log",
          "readers": [
            "production",
            "accountant"
          ]
        },
        {
          "module": "zbirka",
          "name": "people",
          "readers": [
            "production",
            "accountant"
          ]
        },
        {
          "module": "zbirka",
          "name": "assignments",
          "readers": [
            "production",
            "accountant"
          ]
        },
        {
          "module": "zbirka",
          "name": "load",
          "readers": [
            "viewer",
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant"
          ]
        },
        {
          "module": "yakist",
          "name": "protocol_points",
          "readers": [
            "viewer",
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant"
          ]
        },
        {
          "module": "instrument",
          "name": "register",
          "readers": [
            "production",
            "storekeeper",
            "accountant"
          ]
        },
        {
          "module": "instrument",
          "name": "card",
          "readers": [
            "production",
            "storekeeper",
            "accountant"
          ]
        },
        {
          "module": "instrument",
          "name": "held_by",
          "readers": [
            "production",
            "storekeeper",
            "accountant"
          ]
        },
        {
          "module": "instrument",
          "name": "available",
          "readers": [
            "production",
            "storekeeper",
            "accountant"
          ]
        },
        {
          "module": "instrument",
          "name": "assets",
          "readers": [
            "production",
            "accountant"
          ]
        },
        {
          "module": "instrument",
          "name": "checks",
          "readers": [
            "production",
            "storekeeper",
            "accountant"
          ]
        },
        {
          "module": "instrument",
          "name": "filters",
          "readers": [
            "production",
            "storekeeper",
            "accountant"
          ]
        },
        {
          "module": "instrument",
          "name": "custody",
          "readers": [
            "production",
            "storekeeper",
            "accountant"
          ]
        },
        {
          "module": "instrument",
          "name": "person_history",
          "readers": [
            "production",
            "storekeeper",
            "accountant"
          ]
        },
        {
          "module": "instrument",
          "name": "verifications",
          "readers": [
            "production",
            "storekeeper",
            "accountant"
          ]
        },
        {
          "module": "instrument",
          "name": "state_log",
          "readers": [
            "production",
            "storekeeper",
            "accountant"
          ]
        },
        {
          "module": "instrument",
          "name": "workplace_card",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "chronicle",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "chronicle_scope",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "chronicle_kinds",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "chronicle_months",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "chronicle_graph",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "changes",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "items",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "item",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "item_receipts",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "item_moves",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "item_on_hand",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "item_problems",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "item_graph",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "item_units",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "units",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "unit",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "unit_components",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "unit_events",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "unit_graph",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "documents",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "document_chain",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "document_loose",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "document_graph",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "people",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "person",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "person_actions",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "person_counts",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "person_months",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "person_agreements",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "person_payroll",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "person_equipment",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "person_operations",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "person_graph",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "parties",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "party",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "party_events",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "party_items",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "party_months",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "party_graph",
          "readers": [
            "anyone"
          ]
        },
        {
          "module": "slid",
          "name": "deal_steps",
          "readers": [
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant"
          ],
          "about": "The steps of one deal, oldest first. Parameter: id of a customer order (without it, the first example deal). Rows: {row: \"deal\"} once, then per step {row: \"step\", step, key, stage, kind, date, title, text, who} and its parts by the same `step`: \"record\" (type, id, label), \"move\" (item, place, qty), \"line\" (account, side, amount; minor units), \"link\" (from: the earlier step it stands on, text), \"state\" (stock of the product and key components, what the payer owes, the bank). Ledger lines and sums only for a key with the accountant role."
        },
        {
          "module": "slid",
          "name": "deal_examples",
          "readers": [
            "storekeeper",
            "sales",
            "purchaser",
            "production",
            "accountant"
          ],
          "about": "Finished deals that show the whole way (made from a request, produced, checked, shipped, paid), one per payer; the first is what deal_steps answers without an id."
        }
      ]
    }
    curl
    curl 'https://demokrylo.bnp.works/api/v1/views' \
      -H 'authorization: Bearer <ключ>'
  2. 2подання zbirka/people470 мс200

    GET /api/v1/v/zbirka/people

    показати запит і відповідь
    GET /api/v1/v/zbirka/people
    {
      "headers": {
        "authorization": "Bearer <ключ>"
      }
    }
    {
      "rows": [
        {
          "party_id": "42af9d8e-1c9d-44d9-addb-e28eacbe4173",
          "name": "Бойко Наталія Степанівна",
          "workplaces": "SOLDER"
        },
        {
          "party_id": "51f248b7-6f69-4745-8abf-4e5390bd6228",
          "name": "Бондаренко Ігор Сергійович",
          "workplaces": "MECH"
        },
        {
          "party_id": "5c833c91-7fec-4847-acf3-48c04ebb287a",
          "name": "Гнатів Роман Петрович",
          "workplaces": "BENCH"
        },
        {
          "party_id": "e2fa9bca-bf8a-4cfc-8afe-70b5d9a9e33e",
          "name": "Дзюба Олег Миколайович",
          "workplaces": "MECH"
        },
        {
          "party_id": "e2ed15ea-bb6d-48f0-8342-03dc3e447efa",
          "name": "Захарчук Оксана Тарасівна",
          "workplaces": null
        },
        {
          "party_id": "2ce37c28-47ea-4722-9e36-f66224528ad1",
          "name": "Ковальчук Андрій Петрович",
          "workplaces": "SOLDER"
        },
        {
          "party_id": "42362cbe-b787-4d5a-b769-bdf296182aa6",
          "name": "Кравчук Ірина Андріївна",
          "workplaces": null
        },
        {
          "party_id": "1b271108-59f0-44dd-9bcb-77570a45897b",
          "name": "Лисенко Денис Олександрович",
          "workplaces": "FIRMWARE"
        },
        {
          "party_id": "eb3303e6-9078-4ebc-bd7f-f74eec8c8edf",
          "name": "Луцик Богдан Ігорович",
          "workplaces": null
        },
        {
          "party_id": "231df062-e183-4a48-af40-e55e3375d065",
          "name": "Мельник Тарас Ігорович",
          "workplaces": null
        },
        {
          "party_id": "a78a889b-61aa-4f35-b3d5-108976d6bba5",
          "name": "Мороз Катерина Юріївна",
          "workplaces": null
        },
        {
          "party_id": "4bccd470-a95b-48f7-9505-d1fdc7cc8ccd",
          "name": "Павлів Юрій Романович",
          "workplaces": "STORE"
        },
        {
          "party_id": "646543a2-a9fe-4cc1-9392-78db7fb43daf",
          "name": "Петренко Софія Олегівна",
          "workplaces": "PACK"
        },
        {
          "party_id": "3808d757-d0b4-4310-865f-028f40b2c4f0",
          "name": "Савчук Віктор Миколайович",
          "workplaces": "FLIGHT"
        },
        {
          "party_id": "b38cb814-a786-4036-ba4a-3fbd1fc42edd",
          "name": "Сидорук Марія Василівна",
          "workplaces": null
        },
        {
          "party_id": "d993103e-2a15-40f6-a551-27e7e4bcc4f8",
          "name": "Ткаченко Василь Григорович",
          "workplaces": null
        },
        {
          "party_id": "cfd3350f-c666-4d96-9d31-82d493686eb4",
          "name": "Шевчук Ольга Іванівна",
          "workplaces": "CABLE"
        }
      ]
    }
    curl
    curl 'https://demokrylo.bnp.works/api/v1/v/zbirka/people' \
      -H 'authorization: Bearer <ключ>'

Як зробити так само

Ця сторінка - окремий Worker без бази. Вона знає адресу ERP і один ключ; усе інше питає через API.