The Smart Factory Management System is a robust, professional-grade console-based application designed to simulate and manage the core operations of a modern manufacturing facility. Built entirely in C# targeting the .NET 10.0 framework, it provides an advanced Text-based User Interface (TUI) powered by Spectre.Console.
It goes beyond simple data entry, featuring complex polymorphic object interactions, layered architecture, simulated production workflows, and real-time state tracking.
- 🔐 Role-Based Access Control: Highly differentiated access and menus for diverse user roles (Directors, Technicians, Sales Agents, and Accountants).
- ⚙️ Production Management: Initiate, track, and complete intricate production orders (e.g., Motherboards, Microprocessors), utilizing a fleet of specialized machines.
- 📦 Inventory & Batch Tracking: Full visibility into finished goods, dynamic production batches, and intelligent stock capacity alerts.
- 🛠️ Machine Fleet Maintenance: Meticulous tracking of machine conditions, part degradation, performance metrics, and essential maintenance workflows.
- 📊 Comprehensive Reporting: Generate, request, and fulfill dynamic reports on staffing, revenue, machine fleet status, and detailed production summaries.
- 📝 Auditing & Logging: A centralized, robust logging service tracks all critical user actions and system events for complete accountability.
- ⏪ Undo System: Advanced command pattern implementation allowing users to undo specific sensitive operations.
The repository is strictly modularized into distinct namespaces and projects to enforce separation of concerns, scalability, and maintainability. The system heavily relies on Object-Oriented Programming (OOP) principles, employing deep inheritance hierarchies and interface-driven design.
This layer encapsulates all business rules, state, and domain entities. It is completely agnostic of UI or data persistence mechanisms.
Factory: The central state manager, orchestrating employees, machines, inventory, and production queues.EmployeeHierarchy: An abstract base class branching intoDirector,Technician,SalesAgent, andAccountant. Each subclass dictates specific quick actions and menu options.ProductHierarchy: An abstract base defining common traits (cost, price, stock), inherited byMicroprocessorandMotherboard. Employs polymorphic JSON serialization ([JsonDerivedType]).Machine&MachinePart: Simulates factory equipment. Machines consist of degradable parts (PowerSupply,CoolingSystem,ControlUnit,AoiSystem) that wear down during production and require technician intervention.
This layer acts as the bridge between the Core domain and external systems (like the file system), enforcing business logic and data persistence.
JsonRepository<T>: A generic repository pattern implementation handling polymorphic serialization/deserialization of domain objects to/from JSON files, utilizing.NET's latest JSON features.Authentication&AccountService: Manages secure logins, hashing, and role verification.LoggerService: Centralized activity tracking, storing logs with timestamps, origins, and contexts.UndoService: Implements a generic state-reversal mechanism using localized command history.
A rich console application leveraging Spectre.Console for interactive menus, tables, grids, and prompts.
- Strict Decoupling: The UI layer NEVER accesses data stores directly; it exclusively routes requests through the
Serviceslayer. - Handlers (
*MenuHandler.cs): Dedicated handlers for specific modules (e.g.,ProductionMenuHandler,MachineMenuHandler), ensuring theProgram.csremains a clean entry point.
- Navigate to the project's Releases page on GitHub: Latest Release.
- Download the latest
.ziprelease asset. - Extract the contents of the
.zipfile to a secure directory of your choice. - Run the executable (
SmartFactory_ManagementSystem.exeor equivalent depending on your OS) directly from the extracted folder. (Note: Ensure your terminal supports ANSI escape sequences for the best TUI experience. Modern Windows Terminal, iTerm2, or standard Linux terminals work perfectly).
Upon launching the application, you will be greeted by the login screen.
- Default Login: If running for the first time, default users are seeded. (You find them inside the program directory: $My Documents/SmartFactoryData/Employees.json | first time password is password).
- Navigation: Use the
Arrow Keys(Up/Down) to navigate menus, andEnterto select. The UI is designed to be highly intuitive, preventing invalid inputs natively. - Workflows: Technicians manage machines and process orders. Sales Agents manage the product catalog and place new orders. Directors oversee the entire operation and request reports, which Accountants then fulfill.
Throughout the development of this project, several advanced software engineering concepts were applied:
- Advanced OOP: Extensive use of inheritance, abstract classes, method overriding, and polymorphism to model complex factory entities.
- Polymorphic JSON Serialization: Overcoming the challenges of saving and loading lists containing mixed derived types using
[JsonDerivedType]attributes. - Terminal UI Design: Utilizing
Spectre.Consoleto transform a standard text console into an interactive, aesthetically pleasing dashboard. - Layered Architecture: Enforcing strict boundaries between UI, Services, and Core logic, promoting clean code, testability, and easier maintenance.
To ensure the architecture is presentation-friendly and easily digestible, the UML diagrams have been split by their respective architectural layers.
Illustrates the foundational business entities and their deep inheritance structures.
Details the infrastructure layer, including generic repositories, logging, and state management.
Showcases the decoupling of presentation logic into specialized module handlers.