feat(pos): add inventory blueprint — CRUD, operations, physical count, reports, alerts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -352,5 +352,28 @@ CREATE INDEX idx_audit_log_created ON audit_log(created_at);
|
||||
CREATE UNIQUE INDEX idx_inventory_branch_part ON inventory(branch_id, part_number);
|
||||
CREATE INDEX idx_employee_sessions_token ON employee_sessions(token);
|
||||
|
||||
-- =====================
|
||||
-- PHYSICAL COUNTS (two-phase inventory count)
|
||||
-- =====================
|
||||
CREATE TABLE IF NOT EXISTS physical_counts (
|
||||
id SERIAL PRIMARY KEY,
|
||||
branch_id INTEGER NOT NULL REFERENCES branches(id),
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'draft', -- draft, approved, cancelled
|
||||
notes TEXT,
|
||||
employee_id INTEGER REFERENCES employees(id),
|
||||
approved_by INTEGER REFERENCES employees(id),
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
approved_at TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS physical_count_lines (
|
||||
id SERIAL PRIMARY KEY,
|
||||
physical_count_id INTEGER NOT NULL REFERENCES physical_counts(id),
|
||||
inventory_id INTEGER NOT NULL REFERENCES inventory(id),
|
||||
expected_quantity INTEGER NOT NULL,
|
||||
counted_quantity INTEGER NOT NULL,
|
||||
difference INTEGER NOT NULL
|
||||
);
|
||||
|
||||
-- Barcode sequence
|
||||
CREATE SEQUENCE IF NOT EXISTS barcode_seq START 1;
|
||||
|
||||
Reference in New Issue
Block a user