Skip to main content

Overview

Dies (troqueles) are cutting tools used to shape and finish printed materials. P.FLEX tracks their status, location, and compatibility with printing clisés.
Die Management Interface

DieItem Data Model

Complete interface from inventory.models.ts:45-72:

Field Descriptions

serie
string
required
Unique serial number identifying the die (e.g., “TRQ-2045-B”)
medida
string
Physical dimensions, typically in format “ANxAV” (width x advance)Examples:
  • 150x200 = 150mm wide, 200mm advance
  • 6x8 = 6 inches wide, 8 inches advance
ubicacion
string
required
Physical location in warehouse. Numeric values auto-map to rack visualization:
  • 45 → Rack TRQ-1, range 34-66
  • 150 → Rack TRQ-2, range 134-166
z
string
Cylinder gear teeth count. Must match corresponding cliché Z-value for compatibility.Common values: "280", "360", "420"
columnas
number
Number of columns (cavities) in the die. Used for production yield calculations.
repeticiones
number
Number of repetitions per cycle. Multiplied with columnas to calculate output per impression.
material
string
Substrate material the die is designed for:
  • PP (Polypropylene)
  • PE (Polyethylene)
  • BOPP (Biaxially Oriented Polypropylene)
  • Paper
forma
string
Die shape classification:
  • Circular
  • Rectangular
  • Irregular
  • Custom shapes
Used for icon selection in UI (getShapeIcon() function)
estado
string
Current die status:
StatusMeaningBadge Color
OKProduction-readyGreen
DesgasteShowing wearAmber
DañadoDamagedRed
ReparacionUnder repair/maintenanceAmber
Reference: inventory-die.component.ts:154-161
linkedClises
string[]
Array of cliché IDs that work with this die. Enables bidirectional compatibility checks:
linkedClises: ["clise-abc123", "clise-def456"]
history
CliseHistory[]
Shared history interface with clisés. Tracks production runs, maintenance, repairs, etc.

Excel Import

Flexible column mapping for die imports:
// inventory.service.ts:195-206
readonly DIE_MAPPING = {
  'serie': ['serie', 'codigo', 'code', 'id'],
  'cliente': ['cliente', 'client'],
  'medida': ['medida', 'dimensiones'],
  'ubicacion': ['ubicación', 'ubicacion'],
  'z': ['z', 'dientes'],
  'material': ['material', 'sustrato'],
  'forma': ['forma', 'shape'],
  'estado': ['estado', 'status'],
  'columnas': ['columnas', 'col', 'cols', 'cavidades', 'cav'],
  'repeticiones': ['repeticiones', 'rep', 'reps']
};

Import Validation

// inventory.service.ts:377-413
normalizeDieData(rawData: any[]): { valid: DieItem[], conflicts: DieItem[] } {
  const normalized = this.excelService.normalizeData(rawData, this.DIE_MAPPING);
  const mapped: DieItem[] = normalized.map(row => ({
    id: Math.random().toString(36).substr(2, 9),
    serie: String(row.serie || '').trim(),
    cliente: String(row.cliente || '').trim(),
    medida: String(row.medida || '').trim(),
    ubicacion: String(row.ubicacion || '').trim(),
    z: String(row.z || ''),
    columnas: this.excelService.parseNumber(row.columnas),
    repeticiones: this.excelService.parseNumber(row.repeticiones),
    material: String(row.material || '').trim(),
    forma: String(row.forma || '').trim(),
    estado: String(row.estado || 'OK').trim(),
    // ... other fields with defaults
    linkedClises: [],
    history: [],
    hasConflict: false
  }));
  
  const valid = mapped.filter((i: DieItem) => i.serie && i.cliente);
  const conflicts = mapped.filter((i: DieItem) => !i.serie || !i.cliente);
  conflicts.forEach(c => c.hasConflict = true);
  
  return { valid, conflicts };
}
Dies missing serie or cliente will be flagged as conflicts. Review import preview modal before confirming.

KPI Statistics

Dashboard calculates real-time metrics:
// inventory-die.component.ts:454-460
get stats() {
  const total = this.dieItems.length;
  const available = this.dieItems.filter(d => d.estado === 'OK').length;
  const maintenance = this.dieItems.filter(d => 
    d.estado === 'Reparacion' || d.estado === 'Mantenimiento'
  ).length;
  const critical = this.dieItems.filter(d => 
    d.estado === 'Dañado' || d.estado === 'Desgaste'
  ).length;
  return { total, available, maintenance, critical };
}
Displayed as KPI cards with color-coded badges:
  • Total Troqueles: All dies
  • Disponibles: OK status (green)
  • En Mantenimiento: Under repair (amber)
  • Uso Crítico: Damaged or worn (red)

Filtering & Sorting

Advanced filtering with dynamic dropdowns:
// Filter state
filterZ = '';         // Filter by Z-value
filterMaterial = '';  // Filter by material
filterShape = '';     // Filter by shape
searchTerm = '';      // Full-text search

// Dynamic unique values based on search results
get uniqueZs() {
  return [...new Set(this.baseList.map(d => d.z).filter(z => !!z))]
    .sort((a,b) => String(a).localeCompare(String(b), undefined, {numeric: true}));
}

get uniqueMaterials() {
  return [...new Set(this.baseList.map(d => d.material).filter(m => !!m))].sort();
}

get uniqueShapes() {
  return [...new Set(this.baseList.map(d => d.forma).filter(f => !!f))].sort();
}
Reference: inventory-die.component.ts:364-416

Multi-Column Sorting

Click any column header to sort:
toggleSort(column: string) {
  if (this.sortColumn === column) {
    this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
  } else {
    this.sortColumn = column;
    this.sortDirection = 'asc';
  }
}
Sortable columns: medida, ubicacion, z, material, cliente, serie, estado

Shape Icons

UI displays appropriate icons based on die shape:
getShapeIcon(shape: string): string {
  const s = (shape || '').toLowerCase();
  if (s.includes('circ')) return 'circle';
  if (s.includes('cuad') || s.includes('rect')) return 'crop_square';
  return 'pentagon';  // Default for irregular shapes
}
Reference: inventory-die.component.ts:486-491

CRUD Operations

Add Dies

addDies(items: DieItem[]) {
  this._dieItems.next([...items, ...this.dieItems]);
  this.audit.log(
    this.state.userName(), 
    this.state.userRole(), 
    'INVENTARIO', 
    'Alta Troqueles', 
    `Se agregaron ${items.length} troqueles.`
  );
}
Reference: inventory.service.ts:254-257

Update Die

updateDie(item: DieItem) {
  const list = this.dieItems;
  const idx = list.findIndex(i => i.id === item.id);
  if (idx !== -1) {
    list[idx] = item;
    this._dieItems.next([...list]);
    this.audit.log(
      this.state.userName(), 
      this.state.userRole(), 
      'INVENTARIO', 
      'Editar Troquel', 
      `Se modificó el troquel ${item.serie}.`
    );
  }
}
Reference: inventory.service.ts:259-267

Detail Modal

The die detail modal displays:
  1. Header: Serie/Código with edit toggle
  2. Basic Info: Cliente, Medida, Columnas, Repeticiones
  3. Estado Selector: Dropdown with status options:
    • OK
    • Desgaste
    • Dañado
    • En Reparación
  4. Actions: Save button (edit mode) or close button (view mode)
Modal uses dark theme (bg-[#1e293b]) with inline form validation. Reference: inventory-die.component.ts:193-255

Cliché Compatibility

Dies can be linked to compatible clisés via the linkedClises array. This enables:
  • Production Planning: Quickly identify which clisés work with a given die
  • Setup Optimization: Reduce changeover time by grouping compatible jobs
  • Maintenance Coordination: Schedule die maintenance when compatible clisés are also offline
Use Z-value matching as a starting point for compatibility, then manually verify and link clisés that have been successfully used together in production.

Warehouse Integration

Dies are automatically mapped to physical racks:
// inventory.service.ts:318-335
mapItemsToLayout() {
  // ... clear existing items ...
  
  // Map Dies
  dies.forEach(item => {
    if (!item.ubicacion) return;
    const locationNumber = parseInt(item.ubicacion.replace(/\D/g, ''));
    if (!isNaN(locationNumber)) {
      for (const rack of currentLayout) {
        if (rack.type !== 'die') continue;
        for (const level of rack.levels) {
          for (const box of level.boxes) {
            if (box.min !== undefined && box.max !== undefined && 
                locationNumber >= box.min && locationNumber <= box.max) {
              box.items.push(item);
              return;
            }
          }
        }
      }
    }
  });
  
  this._layoutData.next([...currentLayout]);
}
Dies with non-numeric or invalid ubicacion values will not appear in the rack visualization. Ensure consistent location formatting.

Best Practices

Status Updates

Update estado immediately after production runs or maintenance to maintain accurate availability

Material Tracking

Always specify material to enable substrate-based filtering and compatibility checks

Dimension Standards

Use consistent medida format (e.g., “150x200”) for reliable parsing and comparisons

History Logging

Add history entries for repairs, sharpening, and production runs to track die lifecycle

Build docs developers (and LLMs) love