add check horas planning plana

This commit is contained in:
amazuecos
2025-04-03 01:08:29 +02:00
parent bb848d391f
commit b79f490f17
6 changed files with 42 additions and 23 deletions

View File

@ -13,8 +13,10 @@ class PlanningRotativa {
this.papelImpresionHeader = this.item.find('#papel-impresion-name-header')
this.papelImpresionPlanaHeader = this.item.find('#papel-impresion-name-plana-header')
this.checkAllMetros = this.item.find("#metros-check-all")
this.checkAllPliegos = this.item.find("#pliegos-check-all")
this.tiempoPlanaTotal = this.tablePlanningPlana.find('#horas-sel-total')
this.datatableColumns = [
{ data: 'otId', searchable: false, sortable: false, width: "3rem" },
@ -25,10 +27,11 @@ class PlanningRotativa {
{ data: 'papel_ancho', searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'papel_alto', searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'papel_impresion', searchable: false, sortable: false },
{ data: 'papel_gramaje', searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'papel_gramaje',name:"presupuesto_linea.gramaje", searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'corte', searchable: false, sortable: false, render: this.renderCorteImage.bind(this), width: "10rem" },
{ data: 'metros_check', searchable: false, sortable: false, render: d => `<input class="form-check-input metros-check" data-id="${d}" type="checkbox" value="" />` },
{ data: 'metros', searchable: false, sortable: false, render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'action', searchable: false, sortable: false, render: this._renderBtnAction },
]
@ -41,9 +44,10 @@ class PlanningRotativa {
{ data: 'papel_ancho', searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'papel_alto', searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'papel_impresion', searchable: false, sortable: false },
{ data: 'papel_gramaje', searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'papel_gramaje', name:"presupuesto_linea.gramaje", searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'pliegos_check', searchable: false, sortable: false, render: d => `<input class="form-check-input pliegos-check" data-id="${d}" type="checkbox" value="" />` },
{ data: 'pliegosPedido', searchable: false, sortable: false, render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'tiempo_real_sum', searchable: false, sortable: false,render: d => this.formatSeconds(parseFloat(d))},
{ data: 'action', searchable: false, sortable: false, render: this._renderBtnAction },
]
@ -112,6 +116,7 @@ class PlanningRotativa {
this.totalMetrosSel = new AutoNumeric(this.item.find('#metros-sel-total')[0], autoNumericOptions);
this.totalPliegos = new AutoNumeric(this.item.find('#total-pliegos')[0], autoNumericPliegosOptions);
this.totalPliegosSel = new AutoNumeric(this.item.find('#pliegos-sel-total')[0], autoNumericPliegosOptions);
this.maquinaSelectFilter.init()
this.papelImpresionFilter.init()
this.maquinaSelectFilterPlana.init()
@ -261,25 +266,27 @@ class PlanningRotativa {
}
getPapelImpresionSuccess(response) {
this.papelImpresionFilter.setOption(response.id, response.nombre)
this.tablePlanningRot.find('input[name=gramaje]').val(response.gramaje).trigger("change")
this.tablePlanningRot.find('input[name=papel_gramaje]').val(response.gramaje).trigger("change")
this.papelImpresionHeader.text(response.nombre)
}
getPapelImpresionError(response) { }
getPapelImpresionPlanaSuccess(response) {
this.papelImpresionFilterPlana.setOption(response.id, response.nombre)
this.tablePlanningPlana.find('input[name=gramaje]').val(response.gramaje).trigger("change")
this.tablePlanningPlana.find('input[name=papel_gramaje]').val(response.gramaje).trigger("change")
this.papelImpresionPlanaHeader.text(response.nombre)
}
getPapelImpresionPlanaError(response) { }
formatSeconds(s) {
return [parseInt(s / 60 / 60), parseInt(s / 60 % 60)].join(':').replace(/\b(\d)\b/g, '0$1');
const hours = Math.floor(s / 60 / 60)
const minutes = Math.floor(s / 60 % 60)
return [hours, minutes].join(':').replace(/\b(\d)\b/g, '0$1');
}
addTotalFooter() {
const seconds = this.papelGramajeDatatable.column(5).data().reduce((a, b) => {
return parseFloat(a) + parseFloat(b)
}, 0)
const metros = this.papelGramajeDatatable.column(4).data().map((e) => parseFloat(e))
$('#total-tiempo-papel').text(this.formatSeconds(seconds))
$('#total-tiempo-papel').text(this.formatSeconds(parseInt(seconds)))
this.totalMetros.set(metros.reduce((a, b) => a + b, 0))
@ -305,7 +312,14 @@ class PlanningRotativa {
const metros_sel = this.datatablePlanningPlana.rows((idx, data, node) => {
return $(node).find('input[type="checkbox"]').prop('checked');
}).data().toArray().map((e) => parseInt(e.pliegosPedido))
const tiempo_total_sel = this.datatablePlanningPlana.rows((idx, data, node) => {
return $(node).find('input[type="checkbox"]').prop('checked');
}).data().toArray().map((e) => parseFloat(e.tiempo_real_sum))
this.totalPliegosSel.set(metros_sel.reduce((a, b) => a + b, 0))
const totalSeconds = tiempo_total_sel.reduce((a,b) => a+b,0)
console.log("Total seconds",totalSeconds);
this.tiempoPlanaTotal.text(this.formatSeconds(totalSeconds))
}
renderCorteImage(data) {