feat: Premium built and switched off; default machine minimums (front 3, Marcus 10/11)
Premium (8 passadas, R$ 39,90/m, SKU DTFP.TX.100CM) is a fifth textile ready-sheet product: priced on the server and the Site, a hidden fifth card, a PREMIUM hot-folder class, its Tiny SKU, and a products row created disabled by a migration until Dropstar says 'testado'. A machine with no typed minimum now alerts at Dropstar's fixed minimums: 1 roll of film, 1 L of each ink, 5 kg of powder. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,8 +16,9 @@ once, which lets exactly one more card through.
|
||||
clean CLEAN_EVERY_METRES printed since the last "clean" event.
|
||||
align ALIGN_AFTER_FILM_METRES printed since the last film change (a
|
||||
supply entry of "film") with no "align" event after it.
|
||||
supply a supply whose estimated stock is at or below the minimum Gestão set
|
||||
for that machine (no minimum, no alert).
|
||||
supply a supply whose estimated stock is at or below the machine's minimum:
|
||||
the one Gestão typed, or Dropstar's default for that supply (1 roll
|
||||
of film, 1 L of each ink, 5 kg of powder).
|
||||
|
||||
The supply estimate assumes each entry refills what was used since the one
|
||||
before: the use per metre is the quantity entered over the metres printed in
|
||||
@@ -40,6 +41,11 @@ SUPPLY_INTERVALS = 3
|
||||
SUPPLIES = {'film': ('Filme', 'rolo'), 'ink_c': ('Tinta ciano', 'L'), 'ink_m': ('Tinta magenta', 'L'),
|
||||
'ink_y': ('Tinta amarela', 'L'), 'ink_k': ('Tinta preta', 'L'), 'ink_w': ('Tinta branca', 'L'),
|
||||
'powder': ('Poliamida', 'kg')}
|
||||
# Dropstar's fixed minimums (2026-11-10): a machine with no minimum typed uses
|
||||
# these. Units match the supplies: rolls, litres and kilograms.
|
||||
DEFAULT_MINIMUMS = {'film': Decimal('1'), 'ink_c': Decimal('1'), 'ink_m': Decimal('1'),
|
||||
'ink_y': Decimal('1'), 'ink_k': Decimal('1'), 'ink_w': Decimal('1'),
|
||||
'powder': Decimal('5')}
|
||||
PARTS = {'cap': 'Cap', 'damper': 'Damper', 'head': 'Cabeça de impressão', 'wiper': 'Wiper', 'other': 'Outra peça'}
|
||||
EVENTS = {'clean': 'Limpeza', 'align': 'Alinhamento da cabeça', 'stop': 'Parada'}
|
||||
|
||||
@@ -130,8 +136,13 @@ def estimate(entries, metres_between, metres_since_last, minimum=None):
|
||||
'minimum': minimum}
|
||||
|
||||
|
||||
def minimum_for(minimums, item):
|
||||
"""The minimum typed for the machine, or Dropstar's default for that supply."""
|
||||
return minimums.get(item, DEFAULT_MINIMUMS.get(item))
|
||||
|
||||
|
||||
def supply_low(value):
|
||||
"""Whether an estimate is at or below the machine's minimum (no minimum, no alert)."""
|
||||
"""Whether an estimate is at or below the machine's minimum (typed or default)."""
|
||||
return bool(value) and value['minimum'] is not None and value['stock'] <= value['minimum']
|
||||
|
||||
|
||||
@@ -151,7 +162,8 @@ def supply_estimates(c, machine_id):
|
||||
continue
|
||||
printed = [printed_since(c, machine_id, row['created_at']) for row in rows]
|
||||
between = [printed[index - 1] - printed[index] for index in range(1, len(printed))]
|
||||
value = estimate([row['quantity'] for row in rows], between, printed[-1], minimums.get(item))
|
||||
value = estimate([row['quantity'] for row in rows], between, printed[-1],
|
||||
minimum_for(minimums, item))
|
||||
if value is not None:
|
||||
result[item] = value
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user