Machine Management
Relevant source files
The following files were used as context for generating this wiki page:
Machine Management is a core system within the Duplicator project responsible for the lifecycle, configuration, and tracking of reproduction hardware, specifically duplicators and photocopiers. It handles the initial system setup, ongoing administration of machine hardware parameters, and the association of consumable changes with specific hardware units.
The system distinguishes between different hardware types—duplicators (riso-style), ink-based photocopiers, and toner-based photocopiers—applying unique pricing and counter logic to each. This module ensures that print runs and consumable usage are accurately attributed to the correct physical machine, providing the foundation for the project's accounting and reporting features.
Sources: app/models/admin.php:123-140, app/view/setup.html.php:143-170, README.md:15-25
Machine Architecture and Types
The system categorizes hardware into three distinct types, each with its own data model and operational logic. This classification determines how the application calculates costs and tracks mechanical wear through counters.
Hardware Classifications
| Machine Type | Description | Key Components Tracked |
|---|---|---|
| Duplicopieur | High-speed digital duplicators (e.g., Ricoh DX) | Masters, Passes, Multiple Drums |
| Photocop_encre | Inkjet-based photocopiers (e.g., ComColor) | CMYK Ink levels, Passes |
| Photocop_toner | Laser/Toner-based photocopiers (e.g., Konica) | CMYK Toner, Drum units, Developer units |
Sources: app/models/admin.php:57-95, app/view/setup.html.php:145-168, app/models/changement.php:11-38
Machine Data Flow
The following diagram illustrates how machine definitions are created during setup and utilized by the administration and reporting modules.
Setup and Configuration
The initial creation of machines occurs through a dedicated Setup Wizard. This process requires defining hardware names, initial counter readings, and specific pricing for masters and consumables.
Initial Setup Process
- Type Selection: Users choose between Duplicator, Ink Photocopier, or Toner Photocopier.
- Identification: Providing a brand and model name (e.g., "Ricoh DX4545").
- Counters: Inputting "Master" and "Passage" counters to establish a baseline for tracking.
- Drum Configuration: For duplicators, users define available drums (e.g.,
tambour_noir,tambour_bleu) with associated unit and pack prices.
Sources: app/view/setup.html.php:143-233, app/tests/Feature/AdminMachineManagerTest.php:21-36
Maintenance and Counter Tracking
The system tracks mechanical usage through a "Cons" (consumption) table that logs every hardware event, such as a master change or ink replacement.
Counter Logic
The system retrieves the latest counter values to calculate usage between reports.
- Duplicators: Tracks both
nb_m(masters) andnb_p(passes). - Photocopiers: Primarily tracks
nb_p(passes), with ink/toner changes associated with specific color channels.
Sources: app/models/admin.php:104-135, app/models/changement.php:57-85
API and AJAX Operations
The Machine Management module provides several AJAX endpoints for real-time UI updates:
| Endpoint | Purpose | Parameters |
|---|---|---|
get_machine_type | Detects if a machine is toner, ink, or duplicator | machine (name) |
get_last_counters | Retrieves the most recent master and passage counts | machine (name) |
ajax_delete_machine | Removes a machine and its associated history | machine_id, machine_type |
get_machine_data | Fetches full configuration for editing | machine_name |
Sources: app/models/admin.php:57-140, app/public/index.php:403-455
Database Schema
Machines are stored across multiple tables to allow for flexible pricing and historical tracking.
Conclusion
The Machine Management system provides a robust framework for handling diverse printing hardware. By separating hardware definitions from operational logs, it allows the Duplicator application to scale from a single duplicator to a complex collective environment with multiple photocopiers and specialty drums. This centralized management ensures that all calculations for cost-per-page and consumable longevity remain consistent across the platform.