Consommables : ajout compteur poses perdues + ratio corrige 0.5 (10/20)
- Nouvelle carte 'Poses perdues' dans le panneau consommables - Le ratio ruban optimal pour 10x15 est 0.5 (10cm sur 20cm de panneau) - Diagnostic enrichi : alerte epuisement, ruban avant papier, % gaspille - Reset poses perdues avec le ruban Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -223,10 +223,10 @@ def reset_compteur():
|
|||||||
|
|
||||||
# --- Suivi consommables ---
|
# --- Suivi consommables ---
|
||||||
|
|
||||||
TAILLE_RUBAN = {
|
RATIO_RUBAN_OPTIMAL = {
|
||||||
"15x20": 1.0,
|
"10x15": 0.5,
|
||||||
"10x15": 0.667,
|
|
||||||
"10x15-2up": 1.0,
|
"10x15-2up": 1.0,
|
||||||
|
"15x20": 1.0,
|
||||||
"15x20-2up": 1.0,
|
"15x20-2up": 1.0,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,11 +241,17 @@ def maj_consommables(config: dict, copies: int, format_papier: str | None):
|
|||||||
conso["papier_utilise"] = conso.get("papier_utilise", 0) + feuilles
|
conso["papier_utilise"] = conso.get("papier_utilise", 0) + feuilles
|
||||||
conso["photos_imprimees"] = conso.get("photos_imprimees", 0) + copies
|
conso["photos_imprimees"] = conso.get("photos_imprimees", 0) + copies
|
||||||
|
|
||||||
|
ratio_optimal = RATIO_RUBAN_OPTIMAL.get(fmt, 1.0)
|
||||||
if rembobinage:
|
if rembobinage:
|
||||||
ruban_par_feuille = TAILLE_RUBAN.get(fmt, 1.0)
|
ruban_consomme = feuilles * ratio_optimal
|
||||||
else:
|
else:
|
||||||
ruban_par_feuille = 1.0
|
ruban_consomme = feuilles * 1.0
|
||||||
conso["ruban_utilise"] = round(conso.get("ruban_utilise", 0) + feuilles * ruban_par_feuille, 1)
|
|
||||||
|
conso["ruban_utilise"] = round(conso.get("ruban_utilise", 0) + ruban_consomme, 1)
|
||||||
|
|
||||||
|
# Poses perdues = ruban avance inutilement (difference entre consomme et optimal)
|
||||||
|
poses_perdues = feuilles * 1.0 - feuilles * ratio_optimal if not rembobinage else 0
|
||||||
|
conso["poses_perdues"] = round(conso.get("poses_perdues", 0) + poses_perdues, 1)
|
||||||
|
|
||||||
mettre_a_jour_config({"consommables": conso})
|
mettre_a_jour_config({"consommables": conso})
|
||||||
|
|
||||||
@@ -259,6 +265,7 @@ def consommables_etat() -> dict:
|
|||||||
papier_used = conso.get("papier_utilise", 0)
|
papier_used = conso.get("papier_utilise", 0)
|
||||||
ruban_used = conso.get("ruban_utilise", 0)
|
ruban_used = conso.get("ruban_utilise", 0)
|
||||||
photos = conso.get("photos_imprimees", 0)
|
photos = conso.get("photos_imprimees", 0)
|
||||||
|
perdues = conso.get("poses_perdues", 0)
|
||||||
return {
|
return {
|
||||||
"papier_capacite": papier_cap,
|
"papier_capacite": papier_cap,
|
||||||
"papier_utilise": papier_used,
|
"papier_utilise": papier_used,
|
||||||
@@ -267,6 +274,7 @@ def consommables_etat() -> dict:
|
|||||||
"ruban_utilise": ruban_used,
|
"ruban_utilise": ruban_used,
|
||||||
"ruban_restant": max(0, round(ruban_cap - ruban_used, 1)),
|
"ruban_restant": max(0, round(ruban_cap - ruban_used, 1)),
|
||||||
"photos_imprimees": photos,
|
"photos_imprimees": photos,
|
||||||
|
"poses_perdues": perdues,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -278,6 +286,8 @@ def reset_consommables(quoi: str):
|
|||||||
conso["papier_utilise"] = 0
|
conso["papier_utilise"] = 0
|
||||||
if quoi in ("ruban", "tout"):
|
if quoi in ("ruban", "tout"):
|
||||||
conso["ruban_utilise"] = 0
|
conso["ruban_utilise"] = 0
|
||||||
|
conso["poses_perdues"] = 0
|
||||||
if quoi == "tout":
|
if quoi == "tout":
|
||||||
conso["photos_imprimees"] = 0
|
conso["photos_imprimees"] = 0
|
||||||
|
conso["poses_perdues"] = 0
|
||||||
mettre_a_jour_config({"consommables": conso})
|
mettre_a_jour_config({"consommables": conso})
|
||||||
|
|||||||
@@ -937,7 +937,7 @@ html, body {
|
|||||||
|
|
||||||
.conso-grid {
|
.conso-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(4, 1fr);
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -502,6 +502,12 @@
|
|||||||
<div class="conso-titre">Photos sorties</div>
|
<div class="conso-titre">Photos sorties</div>
|
||||||
<div class="conso-gros" id="conso-photos">--</div>
|
<div class="conso-gros" id="conso-photos">--</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="conso-card" id="conso-card-perdues">
|
||||||
|
<div class="conso-icon">⚠</div>
|
||||||
|
<div class="conso-titre">Poses perdues</div>
|
||||||
|
<div class="conso-gros" id="conso-perdues" style="color:#fb8c00">--</div>
|
||||||
|
<div class="conso-chiffres">ruban gaspille sans rembobinage</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3 style="margin-top:1.5rem">Capacites</h3>
|
<h3 style="margin-top:1.5rem">Capacites</h3>
|
||||||
|
|||||||
@@ -1424,21 +1424,46 @@ async function chargerConsommables() {
|
|||||||
barrePapier.style.background = pctPapier < 10 ? '#f44336' : pctPapier < 25 ? '#fb8c00' : '#43a047';
|
barrePapier.style.background = pctPapier < 10 ? '#f44336' : pctPapier < 25 ? '#fb8c00' : '#43a047';
|
||||||
barreRuban.style.background = pctRuban < 10 ? '#f44336' : pctRuban < 25 ? '#fb8c00' : '#43a047';
|
barreRuban.style.background = pctRuban < 10 ? '#f44336' : pctRuban < 25 ? '#fb8c00' : '#43a047';
|
||||||
|
|
||||||
|
const perdues = data.poses_perdues || 0;
|
||||||
|
document.getElementById('conso-perdues').textContent = perdues;
|
||||||
|
const cardPerdues = document.getElementById('conso-card-perdues');
|
||||||
|
if (perdues > 0) {
|
||||||
|
document.getElementById('conso-perdues').style.color = '#f44336';
|
||||||
|
cardPerdues.style.borderLeft = '3px solid #f44336';
|
||||||
|
} else {
|
||||||
|
document.getElementById('conso-perdues').style.color = '#43a047';
|
||||||
|
cardPerdues.style.borderLeft = '3px solid #43a047';
|
||||||
|
}
|
||||||
|
|
||||||
const diag = document.getElementById('conso-diagnostic');
|
const diag = document.getElementById('conso-diagnostic');
|
||||||
const papierUsed = data.papier_utilise;
|
const papierUsed = data.papier_utilise;
|
||||||
const rubanUsed = data.ruban_utilise;
|
const rubanUsed = data.ruban_utilise;
|
||||||
let html = '<strong>Diagnostic</strong><br>';
|
const photos = data.photos_imprimees;
|
||||||
html += `Feuilles consommees : ${papierUsed}<br>`;
|
let html = '<strong>Diagnostic consommables</strong><br>';
|
||||||
|
html += `Feuilles papier consommees : ${papierUsed}<br>`;
|
||||||
html += `Poses ruban consommees : ${rubanUsed}<br>`;
|
html += `Poses ruban consommees : ${rubanUsed}<br>`;
|
||||||
html += `Photos imprimees : ${data.photos_imprimees}<br>`;
|
html += `Photos imprimees : ${photos}<br>`;
|
||||||
|
html += `Poses perdues (gaspillees) : ${perdues}<br>`;
|
||||||
if (papierUsed > 0) {
|
if (papierUsed > 0) {
|
||||||
const ratio = (rubanUsed / papierUsed).toFixed(2);
|
const ratio = (rubanUsed / papierUsed).toFixed(2);
|
||||||
html += `<br>Ratio ruban/papier : <strong>${ratio}</strong>`;
|
html += `<br>Ratio ruban/papier : <strong>${ratio}</strong><br>`;
|
||||||
if (parseFloat(ratio) <= 0.75) {
|
if (parseFloat(ratio) <= 0.75) {
|
||||||
html += ' ✅ Rembobinage actif (economie ruban)';
|
html += '✅ <strong>Rembobinage efficace</strong> — le ruban est economise';
|
||||||
} else if (parseFloat(ratio) >= 0.95) {
|
} else if (parseFloat(ratio) >= 0.95) {
|
||||||
html += ' ⚠ Ratio 1:1 — pas d\'economie ruban';
|
html += '⚠ <strong>Pas d\'economie ruban</strong> — activez le rembobinage dans Materiel';
|
||||||
|
} else {
|
||||||
|
html += '🔄 Rembobinage partiel';
|
||||||
}
|
}
|
||||||
|
if (perdues > 0) {
|
||||||
|
const pctPerdu = ((perdues / (rubanUsed + perdues)) * 100).toFixed(0);
|
||||||
|
html += `<br>🔴 ${pctPerdu}% du ruban gaspille (${perdues} poses pour rien)`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (data.papier_restant <= 20 || data.ruban_restant <= 20) {
|
||||||
|
html += '<br><br>🚨 <strong>Consommable bientot epuise !</strong>';
|
||||||
|
}
|
||||||
|
if (data.ruban_restant < data.papier_restant - 10) {
|
||||||
|
html += '<br>⚠ Le ruban va s\'epuiser avant le papier';
|
||||||
}
|
}
|
||||||
diag.innerHTML = html;
|
diag.innerHTML = html;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user