Update cemento.py
This commit is contained in:
28
cemento.py
28
cemento.py
@@ -27,7 +27,6 @@ def calcola(d):
|
||||
kg = (p[m]/somma_p)*peso_tot if somma_p > 0 else 0
|
||||
s_esatti = kg/w[m] if w[m] > 0 else 0
|
||||
res[f's_{m}'] = math.ceil(s_esatti)
|
||||
res[f'cost_{m}'] = f"{math.ceil(s_esatti)*c[m]:.2f}"
|
||||
tot_s += math.ceil(s_esatti)
|
||||
costo_t += math.ceil(s_esatti)*c[m]
|
||||
|
||||
@@ -56,22 +55,23 @@ def index():
|
||||
def esegui_stampa_cups(f):
|
||||
try:
|
||||
ps_content = f"""%!PS
|
||||
/Helvetica-Bold findfont 18 scalefont setfont
|
||||
100 750 moveto (REPORT TECNICO CALCOLO CEMENTO) show
|
||||
/Helvetica findfont 12 scalefont setfont
|
||||
100 720 moveto (Volume: {f.get('res_vol')} m3 | Peso: {f.get('res_peso')} Kg) show
|
||||
100 705 moveto (Costo: {f.get('res_costo_t')} Euro | Acqua: {f.get('res_aq')} L) show
|
||||
100 680 moveto (ACQUISTI:) show
|
||||
120 665 moveto (- Cemento: {f.get('res_s_cem')} | Sabbia: {f.get('res_s_sab')} | Ghiaia: {f.get('res_s_ghi')}) show
|
||||
100 640 moveto (CARICO BETONIERA ({f.get('res_nc')} carichi):) show
|
||||
120 625 moveto (- Cemento: {f.get('res_bc_cem')} | Sabbia: {f.get('res_bc_sab')} | Ghiaia: {f.get('res_bc_ghi')}) show
|
||||
100 550 moveto (Software Cemento Rev.1 | 20/01/2026) show
|
||||
/Helvetica-Bold findfont 16 scalefont setfont
|
||||
70 750 moveto (REPORT TECNICO CALCOLO CEMENTO) show
|
||||
/Helvetica findfont 11 scalefont setfont
|
||||
70 720 moveto (Volume: {f.get('res_vol')} m3 | Peso: {f.get('res_peso')} Kg) show
|
||||
70 690 moveto (ACQUISTI:) show
|
||||
80 675 moveto (- Cemento: {f.get('res_s_cem')} sacchetti) show
|
||||
80 660 moveto (- Sabbia: {f.get('res_s_sab')} sacchetti) show
|
||||
80 645 moveto (- Ghiaia: {f.get('res_s_ghi')} sacchetti) show
|
||||
70 620 moveto (COSTO TOTALE: {f.get('res_costo_t')} Euro) show
|
||||
70 590 moveto (DOSAGGIO CARICO ({f.get('res_nc')} carichi):) show
|
||||
80 575 moveto (- Cemento: {f.get('res_bc_cem')} | Sabbia: {f.get('res_bc_sab')}) show
|
||||
80 560 moveto (- Ghiaia: {f.get('res_bc_ghi')} | Acqua: {f.get('res_bc_aq')} L) show
|
||||
showpage"""
|
||||
comando = ["docker", "exec", "-i", "cups-pdf-server", "lp", "-d", "Virtual_PDF"]
|
||||
subprocess.run(comando, input=ps_content.encode('utf-8'), capture_output=True)
|
||||
return "OK - PDF generato correttamente!"
|
||||
except Exception as e:
|
||||
return f"Errore: {str(e)}"
|
||||
return "OK - PDF generato in /output!"
|
||||
except Exception as e: return f"Errore: {str(e)}"
|
||||
|
||||
@app.route('/download', methods=['POST'])
|
||||
def download():
|
||||
|
||||
Reference in New Issue
Block a user