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:
Cauê Faleiros
2026-11-11 10:52:08 -03:00
parent e6197d6e40
commit a9a4b61d99
25 changed files with 202 additions and 49 deletions

View File

@@ -1,8 +1,9 @@
"""Each machine's hot folders (Dropstar's third round, item 10, 2026-10-29/30).
FlexiPRINT watches 3. Imprimindo/<máquina>/<C1|C2|C3>/ and takes a file out
of it when it rips. When the operator pulls a card to Imprimindo, its files
go, as a copy, into its machine's folder for the item's contraction class;
FlexiPRINT watches 3. Imprimindo/<máquina>/<C1|C2|C3|PREMIUM>/ and takes a
file out of it when it rips. When the operator pulls a card to Imprimindo, its
files go, as a copy, into its machine's folder for the item's contraction
class; a premium item always goes to PREMIUM, whichever class it carries;
the order's own file stays in its stage folder. A film over 15 m is several
parts (item 13): all on the same machine, in order, never more than two in
the folder at once. The third is written when Flexi takes the first.
@@ -27,6 +28,8 @@ IN_FOLDER = 2
# A computer that claimed a part and never said it was written.
CLAIM_TIMEOUT = timedelta(minutes=10)
CLASSES = ('C1', 'C2', 'C3')
# The premium product's own folder (Dropstar, 2026-11-10, front 3).
PREMIUM = 'PREMIUM'
def contraction(order, index):
@@ -41,6 +44,13 @@ def contraction(order, index):
return item.get('stroke_class') if item.get('stroke_class') in CLASSES else None
def folder_class(order, index):
"""The folder an item's parts go to: PREMIUM for the premium product,
whatever contraction class is recorded, else C1/C2/C3."""
item = order['snapshot']['items'][index]
return PREMIUM if item.get('mode') == 'premium' else contraction(order, index)
def start(c, order_id):
"""The order entered Imprimindo: its approved finals queue for its
machine's folder, item by item, part by part."""
@@ -83,7 +93,7 @@ def claim(c, user):
machine, order = row['machine_id'], row['order_id']
if row['state'] != 'queued' or order in blocked:
continue
cls = contraction(row, row['item_index'])
cls = folder_class(row, row['item_index'])
# A part without its class waits, and the parts after it with it.
if busy.get(machine, 0) >= IN_FOLDER or not cls:
blocked.add(order)