Stock Moves Component
Responsibilities
Section titled “Responsibilities”Mengelola material document atas setiap pergerakan stok masuk, pindah, dan keluar dengan model header-detail untuk menjaga traceability.
Interfaces/APIs
Section titled “Interfaces/APIs”Inputs
Section titled “Inputs”- Move header (doc date, posting date, move type)
- Reference document number
- Product dan lokasi asal atau tujuan
- Quantity aktual, UOM, batch, serial atau tag
Outputs
Section titled “Outputs”- Dokumen stock move tervalidasi yang menjadi dasar update saldo stok dan histori pergerakan.
Error Handling
Section titled “Error Handling”- Menolak movement type tidak valid
- Menolak product atau lokasi referensi tidak valid
- Menolak serial-number item dengan kuantitas tidak sesuai aturan
- Menolak posting yang tidak seimbang terhadap aturan bisnis stok.
Data Structures:
Section titled “Data Structures:”| Field | Data Type | Constraints | Nullable | Description |
|---|---|---|---|---|
| move_id | ULID | Primary Key | Tidak | Identifier dokumen stock move |
| status | ENUM(‘DRAFT’,‘POSTED’,‘CANCELLED’) | Not Null | Tidak | Status workflow dokumen |
| posting_date | TIMESTAMP | Indexed, Not Null | Tidak | Waktu stok resmi berubah di sistem |
| move_type_group | ENUM(‘GR’,‘GI’,‘TP’,‘ADJ’) | Not Null | Tidak | Kelompok pergerakan (receipt, issue, transfer, adjustment) |
| item_id | ULID | Primary Key (line) | Tidak | Identifier baris item move |
| product_id | ULID | Foreign Key -> product_product.product_product_id | Tidak | Produk yang bergerak |
| from_location | ULID | Foreign Key -> location.location_id | Ya | Lokasi asal pergerakan |
| to_location | ULID | Foreign Key -> location.location_id | Ya | Lokasi tujuan pergerakan |
| qty_actual | DECIMAL(15,3) | > 0 | Tidak | Kuantitas aktual yang berpindah |
Algorithms/Logic
Section titled “Algorithms/Logic”Memvalidasi konsistensi header dan item movement, menerapkan aturan serial tracking, lalu mem-posting transaksi agar sinkron dengan saldo stock balances.
State Management
Section titled “State Management”Menyimpan state dokumen dari draft ke posted atau cancelled untuk memastikan audit trail pergerakan barang selalu tersedia.