metallkart-erp/docs/pugina-schema-analysis.md
Louis-Andre 47f1de365f docs: Pugina TLT database schema analysis
Complete analysis of Pugina production system DB (85.91.121.250):
- 2 schemas: mdcrm (43 tables, production CRM) + spo (34 tables, UI framework)
- Key tables: offer (1138 orders), element (8310 parts), production_task_exec (25290 runs)
- 66 foreign keys mapped, reference data documented in Russian
- Integration points identified for MetallKart ERP

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:32:06 +00:00

34 KiB
Raw Blame History

Pugina TLT — Database Schema Analysis

Date: 2026-03-16 Server: 85.91.121.250:5432 Database: tlt PostgreSQL version: 9.6.11 (Windows/MinGW build) Server encoding: WIN1251 (Cyrillic Windows)


1. Overview

The Pugina database contains 2 active schemas with 77 tables total:

Schema Tables Description
mdcrm 43 Core production/CRM — orders, elements, production tasks, storage
spo 34 SPO framework — forms, SQL configs, users, groups, reports (metadata/UI framework)

Total estimated rows across all tables: ~78,500 (moderate volume).


2. Schema mdcrm — Core Production System

2.1 Tables and Row Counts

Table Est. Rows Description
offer 1,138 Commandes/заказы — central entity (orders from clients)
element 8,310 Детали/éléments — parts/pieces belonging to offers
element_stage 445 Element processing stages (laser, bending, painting)
element_addwork 0 Additional work on elements
element_type 0 Element types reference (Деталь, Компонент, Материал, Заготовка, Изделие)
customer 175* Клиенты — clients, workers, juridical entities
customer_property 0 Dynamic customer properties
customer_property_history 0 Customer property change history
customer_property_type 0 Property type definitions
production_task 2,394 Производственные задания — production tasks
production_task_element 6,108 Elements within production tasks
production_task_exec 25,290 Executions of production tasks (largest table!)
production_task_exec_element 1,083 Elements within task executions
production_task_exec_label 0 Labels on executions
production_task_file 2,371 Files attached to production tasks
production_plan 337 Production plans (date ranges, by machine/stage)
lxds_file 1,343 LXDS/nesting files (CAD/CAM cutting optimization)
lxds_file_file 1,257 Physical files for LXDS
lxds_nestresult 2,301 Nesting results (plate optimization)
lxds_nestresult_parts 5,450 Parts within nesting results
lxds_parts 4,000 Parts definitions for nesting
storage 0 Storage locations
storage_shelf 1 Storage shelves
storage_shelf_element_in 3,370 Stock IN — elements entering shelves
storage_shelf_element_out 3,376 Stock OUT — elements leaving shelves
storage_shelf_stage 0 Shelf-stage associations
storage_shelf_type 0 Shelf type reference
storage_send 291 Shipping/sending records
offer_state 5* Offer status reference
stage 7* Production stages reference
metal_type 6* Metal types reference
material_type 7* Material types reference
machine 0 Machines reference
purpose 4* Lead source reference
importance 0 Priority reference
color 0 Color codes reference
unit 8* Units of measure reference
label 0 Labels reference
jobpos 1 Job positions
barcode_manual 0 Manual barcode configuration
md_offer_task 0 Offer-level tasks
md_offer_task_element 0 Elements in offer tasks
test_ 0 Test table (empty)

Row counts from pg_stat may undercount reference tables; values confirmed via queries.

2.2 Reference Data (Справочники)

Stages (Этапы производства)

id name order_id
1 Лазер (Laser) 1
2 Гибка (Bending) 2
3 Покраска (Painting) 3
4 Комплектовка (Assembly) 4
5 Субподряд гибка (Subcontract bending) 5
6 Субподряд покраска (Subcontract painting) 6
7 Труборез (Tube cutting) 1

Offer States (Статусы заказа)

id name
10 Расчет (Calculation)
11 Согласование с директором (Director approval)
12 КП (Commercial proposal)
13 Счет договор (Invoice/contract)
14 Планирование (Planning)

Metal Types (Типы металла)

id name
1 Х/К (Cold-rolled)
2 Г/К (Hot-rolled)
3 ОЦ (Galvanized)
4 Нерж. (Stainless)
5 Проф труба (Profile tube)
6 Круг труба (Round tube)

Material Types (Типы материалов)

id name
1 Упаковка (Packaging)
2 Листовой металл (Sheet metal)
3 Трубы (Pipes/tubes)
4 Метизы (Fasteners)
5 Лакокрасочные (Paint/coating)
6 Комплектующие (Components)
7 РТИ и пластик (Rubber/plastic)

Element Types (Типы элементов)

id name
1 Деталь (Part)
2 Компонент (Component)
3 Материал (Material)
8 Заготовка (Blank/workpiece)
9 Изделие (Product)

Units (Единицы измерения)

шт (pcs), кг (kg), мм (mm), м (m), пм (linear m), л (liter), пч (?), рл (roll)

Purpose (Источники заказов)

Источник ХЗ, С сайта, С рекламы Яндекс, С социальных сетей

2.3 Table Details


mdcrm.offer — Orders/Commandes (центральная сущность)

PK: id (serial) | Est. rows: 1,138

Column Type Nullable Default Description
id integer NO nextval Primary key
customer_id_in integer YES FK → customer (ordering client)
customer_id_tech integer YES FK → customer (technical contact)
customer_id_private integer YES FK → customer (private person)
customer_name varchar(1000) YES Denormalized client name
note varchar(1000) YES Notes
offer_date date YES today Order date
prod_date date YES Production date
send_date date YES Shipping date
plan_date timestamp YES Planned date
time_done timestamp YES Completion timestamp
time_finished timestamp YES Finished timestamp
address_delivery varchar(1000) YES Delivery address
receiver varchar(1000) YES Receiver name
receiver_passport varchar(1000) YES Receiver passport
receiver_phone varchar(1000) YES Receiver phone
receiver_pretension varchar(1000) YES Receiver pretension info
cost numeric(20) YES Total cost
cost_paid numeric(20) YES 0 Amount paid
purpose_id integer YES FK → purpose (lead source)
color_id integer YES FK → color
importance_id integer YES FK → importance
offer_state_id integer YES FK → offer_state (status)
offer_qty integer YES Quantity
delivery_place_qty integer YES Number of delivery points
is_sel_mark boolean YES false Selection mark
is_del_mark boolean YES false Deletion mark (soft delete)
is_finished boolean YES false Is finished
is_ready_produce boolean YES false Ready for production
is_delivered boolean YES false Delivered
is_request boolean YES false Is request (not confirmed order)
calc_id integer YES Calculator reference
import_data varchar(100000) YES Import data blob
is_import_done boolean YES false Import completed
import_done_time timestamp YES Import completion time
note_storage varchar(1000) YES Storage notes
time_stamp timestamp YES now() Last modified
user_name varchar(1000) YES current_user Modified by

Foreign Keys:

  • customer_id_incustomer.id
  • customer_id_techcustomer.id
  • customer_id_privatecustomer.id
  • purpose_idpurpose.id
  • importance_idimportance.id
  • offer_state_idoffer_state.id

mdcrm.element — Parts/Details (детали заказа)

PK: id (serial) | Est. rows: 8,310

Column Type Nullable Description
id integer NO Primary key
offer_id integer YES FK → offer
name varchar(1000) YES Part name
qty integer YES Quantity per unit
qty_itm integer YES Quantity items
qty_set integer YES Quantity in set
thick numeric(20) YES Thickness (mm)
metal_type_id integer YES FK → metal_type
metal_density numeric(20) YES Metal density
material_type_id integer YES FK → material_type
element_type_id integer YES FK → element_type
unit_id integer YES FK → unit
size_x integer YES Width (mm)
size_y integer YES Height (mm)
element_weight numeric(20) YES Weight per element
kit_weight numeric(20) YES Total weight for kit
rate numeric(20) YES Rate
material_price numeric(20) YES Material price
material_cost numeric(20) YES Material total cost
cut_length numeric(20) YES Cut length
incut_qty integer YES Inner cut qty
cut_metr_price numeric(20) YES Cut price per meter
incut_price numeric(20) YES Inner cut price
cut_element_cost numeric(20) YES Cut cost per element
cut_kit_cost numeric(20) YES Cut cost per kit
flex_qty integer YES Bend qty
flex_price numeric(20) YES Bend price
flex_element_cost numeric(20) YES Bend cost per element
flex_kit_cost numeric(20) YES Bend cost per kit
paint_qty integer YES Paint qty
paint_price numeric(20) YES Paint price
paint_kit_qty integer YES Paint kit qty
drill_qty integer YES Drill qty
drill_cost numeric(20) YES Drill cost
prod_element_cost numeric(20) YES Production cost per element
prod_cost numeric(20) YES Total production cost
element_cost numeric(20) YES Total element cost
kit_cost numeric(20) YES Total kit cost
customer_id_supply integer YES FK → customer (supplier)
customer_supply varchar(1000) YES Supplier name (denorm)
element_type varchar(1000) YES Element type (denorm)
technology varchar(1000) YES Technology description
note varchar(1000) YES Notes

Foreign Keys: offer_id→offer, metal_type_id→metal_type, material_type_id→material_type, unit_id→unit, element_type_id→element_type, customer_id_supply→customer


mdcrm.customer — Clients/Workers

PK: id (serial) | Est. rows: 175

Column Type Nullable Description
id integer NO Primary key
name varchar(1000) NO Full name
short_name varchar(1000) YES Short name
email varchar(1000) YES Email
phone varchar(1000) YES Phone
gender boolean YES Gender (false=default)
address_post varchar(1000) YES Postal address
address_jur varchar(1000) YES Legal address
passport varchar(1000) YES Passport data
passport_file bytea YES Passport scan
pasport_file_name varchar(1000) YES Passport filename
customer_type_id integer YES 1
customer_id integer YES FK → customer (self-ref: parent company)
receiver varchar(1000) YES Receiver
receiver_passport varchar(1000) YES
receiver_phone varchar(1000) YES
address_delivery varchar(1000) YES
note varchar(1000) YES
is_jur boolean YES Is juridical entity
is_private boolean YES Is private person
is_worker boolean YES Is a worker/employee
worker_type_id integer YES Worker type
date_begin date YES today
date_end date YES End date
inn varchar(1000) YES ИНН (tax ID)
ogrn varchar(1000) YES ОГРН
kpp varchar(1000) YES КПП
bank_account varchar(1000) YES Bank account
bik varchar(1000) YES БИК
bank varchar(1000) YES Bank name
cor_account varchar(1000) YES Correspondent account
color integer YES Color code
jobpos_id integer YES FK → jobpos
website varchar(1000) YES Website

Self-referencing FK: customer_idcustomer.id (parent company/contact hierarchy)

Note

: This table stores BOTH clients and workers (employees). is_jur = юридическое лицо, is_worker = сотрудник.


mdcrm.production_task — Production Tasks

PK: id (serial) | Est. rows: 2,394

Column Type Nullable Description
id integer NO Primary key
stage_id integer YES FK → stage (production stage)
machine_id integer YES FK → machine
metal_type_id integer YES FK → metal_type
lxds_nestresult_id integer YES FK → lxds_nestresult
note varchar(1000) YES Notes
program_note varchar(1000) YES CNC program notes
program_file bytea YES CNC program binary
program_file_name varchar(1000) YES Program filename
program_file_path varchar(1000) YES File path
thick numeric(20) YES Material thickness
sheet_size varchar(1000) YES Sheet dimensions
sheet_size_to_cut varchar(1000) YES Sheet size to cut
execute_qty integer YES Quantity to execute
begin_time timestamp YES Start time
end_time timestamp YES End time
prod_time time YES Production time
prod_time_elem interval YES Production time per element
is_ready_for_plan boolean YES Ready for planning
is_archive boolean YES Archived
import_data varchar(100000) YES Import data
is_import_done boolean YES Import flag
import_done_time timestamp YES
import_rule varchar(1000) YES
offer_id_imp varchar(1000) YES Imported offer reference

mdcrm.production_task_exec — Task Executions (крупнейшая таблица)

PK: id (serial) | Est. rows: 25,290

Column Type Nullable Description
id integer NO Primary key
production_task_id integer YES FK → production_task
production_plan_id integer YES FK → production_plan
order_id integer YES Execution order number
customer_id integer YES FK → customer
note varchar(1000) YES Notes
begin_time timestamp YES Start
end_time timestamp YES End
color_id integer YES Color reference
exec_nom integer YES Execution number
end_note varchar(1000) YES Completion notes
sheet_size_remain varchar(1000) YES Remaining sheet
sheet_size_cuted varchar(1000) YES Cut sheet size

mdcrm.production_plan — Production Plans

PK: id (serial) | Est. rows: 337

Column Type Nullable Description
id integer NO Primary key
name varchar(1000) YES Plan name
note varchar(1000) YES Notes
begin_date date YES Start date
end_date date YES End date
stage_id integer YES FK → stage
machine_id integer YES FK → machine
is_actual boolean YES Is current
is_archive boolean YES Is archived
is_produce boolean YES In production

mdcrm.storage_shelf_element_in — Stock IN

PK: id (serial) | Est. rows: 3,370

Column Type Nullable Description
id integer NO Primary key
storage_shelf_id integer YES FK → storage_shelf
production_task_exec_id integer YES FK → production_task_exec
element_id integer YES FK → element
customer_id integer YES FK → customer
qty integer YES Quantity
note varchar(1000) YES Notes

mdcrm.storage_shelf_element_out — Stock OUT

PK: id (serial) | Est. rows: 3,376

Column Type Nullable Description
id integer NO Primary key
storage_shelf_id integer YES FK → storage_shelf
element_id integer YES FK → element
customer_id integer YES FK → customer
storage_send_id integer YES FK → storage_send
qty integer YES Quantity
note varchar(1000) YES Notes

mdcrm.storage_send — Shipping

PK: id (serial) | Est. rows: 291

Column Type Nullable Description
id integer NO Primary key
offer_id integer YES FK → offer
customer_id integer YES Customer reference
send_date date YES Shipping date
sender varchar(1000) YES Sender
receiver varchar(1000) YES Receiver
is_done boolean YES Completed
note varchar(1000) YES Notes

mdcrm.lxds_file — LXDS Nesting Files (CAD/CAM)

PK: id (serial) | Est. rows: 1,343

Column Type Nullable Description
id integer NO Primary key
name varchar(1000) YES File name
path varchar(1000) YES File path
stage_id integer YES FK → stage
offer_id varchar(1000) YES Offer reference (string!)
xml_parts varchar(1M) YES XML parts data
results_count integer YES Number of results
is_archive boolean YES Archived
is_import_done boolean YES Import done
import_rule varchar(1000) YES Import rule

LXDS tables store CAD/CAM nesting optimization data (plate cutting layout).


2.4 Remaining mdcrm Tables (abbreviated)

mdcrm.element_stage (445 rows)

Links elements to production stages with pricing. FK: offer_id→offer, element_id→element, stage_id→stage.

mdcrm.element_addwork (0 rows)

Additional work items per element. FK: offer_id→offer, element_id→element.

mdcrm.production_task_element (6,108 rows)

Elements included in production tasks. FK: production_task_id→production_task, element_id→element, offer_id→offer, stage_id→stage.

mdcrm.production_task_exec_element (1,083 rows)

Elements processed during task execution. FK: production_task_exec_id→production_task_exec, production_task_element_id→production_task_element, storage_shelf_id→storage_shelf, storage_shelf_element_in_id→storage_shelf_element_in.

mdcrm.production_task_exec_label (0 rows)

Labels applied during execution. FK: production_task_exec_id, label_id, customer_id.

mdcrm.production_task_file (2,371 rows)

Files attached to production tasks. FK: production_task_id, lxds_file_file_id.

mdcrm.md_offer_task / md_offer_task_element (0 rows)

Task management at offer level with element breakdown.

mdcrm.lxds_file_file (1,257 rows)

Physical files linked to LXDS files. FK: lxds_file_id.

mdcrm.lxds_nestresult (2,301 rows)

Nesting optimization results. FK: lxds_file_id.

mdcrm.lxds_nestresult_parts (5,450 rows)

Parts in nesting results. FK: lxds_file_id, lxds_nestresult_id, lxds_parts_id.

mdcrm.lxds_parts (4,000 rows)

Parts definitions for nesting. FK: lxds_file_id, element_id.

mdcrm.storage / storage_shelf / storage_shelf_type / storage_shelf_stage

Storage hierarchy: storage → shelf → shelf_type. Stages linked via storage_shelf_stage.

mdcrm.barcode_manual (0 rows)

Barcode generation configuration.


3. Schema spo — SPO Application Framework

The spo schema is a generic application framework (likely "СПО" = Система Программного Обеспечения). It stores metadata for a Delphi-based desktop application: forms, SQL queries, field definitions, user permissions, reports.

3.1 Tables and Row Counts

Table Est. Rows Description
spo_user 2 Application users
spo_grup 0 User groups
spo_grup_user 4 User-group assignments
spo_grup_form 51 Group-form access
spo_grup_report 0 Group-report access
spo_form 196 Form definitions (UI screens)
spo_form_access 1 Form access rules
spo_form_access_grup 1 Form access by group
spo_form_condition 10 Form filter conditions
spo_form_condition_access 0 Condition-level access
spo_form_condition_sav 0 Saved filter presets
spo_form_events 1 Form-level event scripts
spo_form_report 2 Reports linked to forms
spo_sql 6 SQL dataset definitions
spo_sql_fields 46 Field definitions for datasets
spo_sql_fields_user_props 0 User-specific field display
spo_sql_fields_user_props_tmp 0 Temporary user field props
spo_sql_action 2 SQL actions (INSERT/UPDATE/DELETE permissions)
spo_sql_condition 0 SQL conditions
spo_sql_events 1 SQL-level events
spo_sql_grup 0 SQL dataset group permissions
spo_sql_menu 1 Custom menu items
spo_report 0 Report definitions
spo_report_params 0 Report parameters
spo_kls 0 Classifiers (data types, enums)
spo_param 0 System parameters
spo_common_values 0 Shared values store
spo_remind 0 Reminders
spo_remind_user 0 User-reminder assignments
spo_user_remind 0 User reminder settings
spo_file 0 Application binary versions
spo_file_load 2 Application version history
period 0 Period definitions
vmsg_str 0 Message strings

The spo schema is the application runtime framework — not business data. It defines the UI, permissions, and reporting layer of the Pugina desktop application.


4. Foreign Key Relationships Map

4.1 mdcrm Schema — Entity Relationship Diagram (textual)

                     ┌──────────┐
                     │ customer │ (175 rows, clients+workers)
                     │  id (PK) │
                     │  customer_id → self (parent)
                     └────┬─────┘
                          │
          ┌───────────────┼──────────────────┐
          │               │                  │
     ┌────▼────┐    ┌─────▼──────┐    ┌──────▼──────┐
     │  offer  │    │  storage   │    │storage_send │
     │(1138 r.)│    │            │    │  (291 r.)   │
     │ id (PK) │    └──────┬─────┘    └─────────────┘
     └────┬────┘           │
          │          ┌─────▼──────┐
          │          │storage_shelf│
          │          │   (1 r.)   │
          │          └──┬──────┬──┘
          │             │      │
    ┌─────▼─────┐  ┌───▼───┐ ┌▼──────────────────┐
    │  element  │  │shf_in │ │ storage_shelf_out  │
    │ (8310 r.) │  │(3370) │ │    (3376 r.)       │
    │ offer_id→ │  └───────┘ └────────────────────┘
    └─────┬─────┘
          │
    ┌─────▼─────────────┐
    │ element_stage(445) │    ┌──────────────┐
    │ element_addwork(0) │    │   lxds_file  │
    └───────────────────┘    │  (1343 r.)   │
                              └──────┬───────┘
                                     │
    ┌────────────────────┐    ┌──────▼───────┐
    │ production_plan    │    │lxds_nestresult│
    │    (337 r.)        │    │  (2301 r.)   │
    └────────┬───────────┘    └──────┬───────┘
             │                       │
    ┌────────▼───────────┐    ┌──────▼────────────┐
    │ production_task    │◄───│lxds_nestresult_parts│
    │   (2394 r.)        │    │   (5450 r.)        │
    └────────┬───────────┘    └────────────────────┘
             │
    ┌────────▼───────────────┐
    │production_task_element  │
    │      (6108 r.)          │
    └────────┬───────────────┘
             │
    ┌────────▼───────────────┐
    │production_task_exec     │ (LARGEST: 25,290 rows)
    │                         │
    └────────┬───────────────┘
             │
    ┌────────▼───────────────────┐
    │production_task_exec_element │
    │        (1083 r.)            │
    └─────────────────────────────┘

4.2 Complete FK List — mdcrm

Source Table Column → Target Table Target Column
customer customer_id customer id
element offer_id offer id
element metal_type_id metal_type id
element material_type_id material_type id
element unit_id unit id
element element_type_id element_type id
element customer_id_supply customer id
element_addwork element_id element id
element_addwork offer_id offer id
element_stage stage_id stage id
element_stage element_id element id
element_stage offer_id offer id
lxds_file stage_id stage id
lxds_file_file lxds_file_id lxds_file id
lxds_nestresult lxds_file_id lxds_file id
lxds_nestresult_parts lxds_file_id lxds_file id
lxds_nestresult_parts lxds_nestresult_id lxds_nestresult id
lxds_nestresult_parts lxds_parts_id lxds_parts id
lxds_parts element_id element id
lxds_parts lxds_file_id lxds_file id
machine stage_id stage id
md_offer_task_element element_id element id
md_offer_task_element md_offer_task_id md_offer_task id
offer purpose_id purpose id
offer customer_id_private customer id
offer customer_id_tech customer id
offer importance_id importance id
offer offer_state_id offer_state id
offer customer_id_in customer id
production_plan machine_id machine id
production_plan stage_id stage id
production_task machine_id machine id
production_task metal_type_id metal_type id
production_task stage_id stage id
production_task lxds_nestresult_id lxds_nestresult id
production_task_element production_task_id production_task id
production_task_element element_id element id
production_task_element offer_id offer id
production_task_element stage_id stage id
production_task_exec production_plan_id production_plan id
production_task_exec customer_id customer id
production_task_exec production_task_id production_task id
production_task_exec_element production_task_exec_id_prev production_task_exec id
production_task_exec_element production_task_element_id production_task_element id
production_task_exec_element production_task_exec_id production_task_exec id
production_task_exec_element storage_shelf_element_in_id storage_shelf_element_in id
production_task_exec_element storage_shelf_id storage_shelf id
production_task_exec_label label_id label id
production_task_exec_label production_task_exec_id production_task_exec id
production_task_exec_label customer_id customer id
production_task_file lxds_file_file_id lxds_file_file id
production_task_file production_task_id production_task id
storage customer_id customer id
storage_send offer_id offer id
storage_shelf storage_id storage id
storage_shelf storage_shelf_type_id storage_shelf_type id
storage_shelf_element_in production_task_exec_id production_task_exec id
storage_shelf_element_in customer_id customer id
storage_shelf_element_in element_id element id
storage_shelf_element_in storage_shelf_id storage_shelf id
storage_shelf_element_out element_id element id
storage_shelf_element_out customer_id customer id
storage_shelf_element_out storage_send_id storage_send id
storage_shelf_element_out storage_shelf_id storage_shelf id
storage_shelf_stage stage_id stage id
storage_shelf_stage storage_shelf_id storage_shelf id

5. Business Domain Analysis

5.1 Core Business Flow

The Pugina system manages a metal fabrication production workflow:

Client Request → Offer (заказ) → Elements (детали) → Production Tasks → Execution → Storage → Shipping
  1. Offer (заказ/commande) — Client order with cost, dates, status
  2. Element (деталь) — Individual parts with detailed costing: material, cutting, bending, painting, drilling
  3. Production Task — Tasks by stage (laser, bending, painting, tube cutting) with CNC programs
  4. Execution — Actual production runs tied to plans and machines
  5. Storage — Shelf-based inventory tracking (IN from production, OUT for shipping)
  6. Shipping (storage_send) — Delivery records

5.2 Tables Corresponding to ERP Domains

ERP Domain Pugina Tables Notes
Orders offer, offer_state offer = заказ. State: Расчет→Согласование→КП→Счет/Договор→Планирование
Materials/Stock element, metal_type, material_type, element_type Detailed part specs with full costing
Production production_task, production_task_exec, production_plan, stage, machine 7 stages, task execution tracking
CAD/CAM lxds_* (5 tables) Nesting optimization for sheet metal cutting
Inventory storage, storage_shelf, storage_shelf_element_in/out Simple shelf-based IN/OUT tracking
Shipping storage_send Linked to offers
Clients customer Dual-purpose: clients AND workers

5.3 Key Observations

  1. Active production system: 25,290 task executions, 1,138 offers, 8,310 elements — system is actively used.
  2. Recent data: Latest offers dated March 2026 — system is current.
  3. CAD/CAM integration: LXDS nesting tables suggest integration with laser cutting software (Lantek/SigmaNEST or similar).
  4. No financial tracking: No payment/invoice/accounting tables — finances are handled externally.
  5. No user auth in mdcrm: Only spo_user (2 users) exists in the SPO framework — the app uses its own auth.
  6. Flat storage model: Single shelf (1 row), all elements go IN/OUT from the same location.
  7. WIN1251 encoding: Russian Windows encoding — needs UTF8 conversion for any integration.
  8. PostgreSQL 9.6: End of life since November 2021. Running on Windows.
  9. Denormalization: Customer names, element types stored as both FK and text fields.
  10. Simple workflow: Only 5 offer states vs. our ERP's 10+ order statuses.

5.4 Integration Points with MetallKart ERP

Integration Source (Pugina) Target (ERP) Approach
Orders offer Order Sync offer_id, dates, status, cost
Clients customer (is_jur=true) Client Match by INN or name
Workers customer (is_worker=true) User Read-only reference
Production status production_task_exec Order status updates Aggregate exec status
Parts/BOM element PurchaseRequirement Map material needs
Stock storage_shelf_element_in/out Inventory Read current quantities
Costing element (cost fields) FinancialTracking Import actual production costs
Nesting/CNC lxds_* Not needed for ERP

5.5 Data Quality Notes

  • offer.cost is mostly NULL in recent records — cost may be tracked at element level
  • offer_date has some invalid dates (0100-01-01, 9385-11-26) — data quality varies
  • offer_state_id is mostly NULL in recent offers — states may not be consistently used
  • customer.inn is rarely populated — client matching will need to use name-based matching
  • All varchar columns are 1000 chars — no real constraints on field lengths

6. Volumetry Summary

Metric Value
Total tables 77 (43 mdcrm + 34 spo)
Total estimated rows ~78,500
Largest table production_task_exec (25,290)
Active offers ~1,138
Active elements ~8,310
Clients ~175
Production stages 7
DB size (not measured — moderate)
Date range ~20242026 (active)