Skip to content

Veexeq/PBD-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🪑 Furniture Production & Sales Management System (T-SQL)

SQL Server T-SQL Python Status: Complete

An enterprise-grade MS SQL Server database system designed to manage the full business lifecycle of a furniture manufacturing company. This project integrates e-commerce sales, complex Bill of Materials (BOM) manufacturing, and automated supply chain logistics.


📂 Database Architecture

Database Architecture

The system utilizes 24 tables structured into four logical zones to ensure maximum data integrity and performance:

  1. Dictionaries: Standardized lookups for Categories, Materials, System Statuses, Cities, and Occupations.
  2. Core Entities: Management of Products, Parts, Customers, Suppliers, and Employees.
  3. Extensions & Warehouse: Specialized 1:1 tables for Individual vs. Corporate clients and real-time stock management for both components and finished goods.
  4. Transactions & History: The engine handling Orders, Production tasks, and a full audit trail for every status transition.

⚙️ Technical Features & Logic

🛠️ Production & Supply Chain

  • BOM Management: Defines complex product structures via recursive-style recipes in ProductRecipes.
  • Resource Planning: Functions to estimate production time and verify employee availability (f_IsEmployeeAvailable) before assigning tasks.
  • Automated Stock Alerts: Triggers monitor inventory levels and automatically log "Low Stock" alerts to SystemLogs when quantities fall below ResupplyThreshold.
  • Supply Workflow: Procedures to order parts from suppliers and receive deliveries with automated inventory updates using MERGE logic.

🛒 Sales & Automation

  • JSON-Powered Orders: Uses sp_PlaceClientOrder to parse nested product lists in JSON format, allowing for high-performance bulk order processing.
  • Status History Tracking: Triggers automatically archive the history of every order, capturing BeginningDate and EndDate for every phase of the lifecycle.
  • Data Protection: INSTEAD OF triggers prevent the modification or deletion of completed orders to maintain immutable historical financial records.

📈 Business Intelligence (Views)

The system includes over 20 specialized views for management reporting:

  • Financials: Unit cost calculation (Materials + Labor) and periodic cost reports (Weekly/Monthly/Quarterly).
  • Sales Analytics: Detailed customer summaries, revenue tracking with discounts, and time-based sales trends.
  • Operational Control: Planned production queues, upcoming deliveries, and inventory health dashboards.

🐍 Data Generation

The database is populated with realistic, high-volume data generated via a Python script using the Faker library:

  • Volume: ~100 sales orders, 100 supply orders, and 100 production tasks.
  • Consistency: The generator ensures logical date sequences (Order Date < Completion Date) and valid NIP/Phone formats.

🧪 Testing Suite

The project includes a robust transactional unit testing framework. Each module (Sales, Production, Supply) is verified through "Happy Path" and "Error Handling" scenarios:

  • Sales Tests: Verify stock reduction, order valuation, and edit-lock triggers.
  • Production Tests: Validate material cost calculators and employee assignment logic.
  • Safety: All tests run within a transaction that is rolled back at the end, keeping the production environment clean.

🚀 Installation & Setup

Important

For detailed step-by-step instructions on environment setup, script execution order, and data generation, please refer to the INSTALL.md file.

Quick Start Summary:

  1. Schema: Execute DDL_Initialize_DB.sql to build the tables.
  2. Logic: Run scripts for Views, Functions, Procedures, and Triggers.
  3. Seed: Populate the database using DML_Seed_Data.sql.
  4. Verify: Run the built-in Test Suites to confirm the system is fully operational.

👥 Authors

  • Wiktor Trybus along with two colleagues

Developed as a final project for the "Databases" (Podstawy Baz Danych) course at AGH University of Science and Technology (Faculty of Computer Science, 2025/2026).

About

Comprehensive T-SQL database system for a furniture manufacturing and e-commerce enterprise. Implements production planning (BOM), real-time inventory tracking, sales automation, and multi-level business analytics using MS SQL Server.

Topics

Resources

Stars

Watchers

Forks

Contributors