diff --git a/assets/js/mediciones.js b/assets/js/mediciones.js index 0ec6a96..087a030 100644 --- a/assets/js/mediciones.js +++ b/assets/js/mediciones.js @@ -37,7 +37,7 @@ function PesoMetro() { let longMuestra = $("#long-muestra").val(); let pesoMuestra = $("#kg-muestra").val(); let ggMuestra = pesoMuestra / longMuestra; - $("#gmm-muestra").val(ggMuestra.toFixed(2)); + $("#gmm-muestra").val(ggMuestra.toFixed(3)); } function Refresco(producto, po) { @@ -104,37 +104,37 @@ function GetTolerancias(producto) { // set tolerancias max rec var tolMaxRecHeaders = document.querySelectorAll("#tol-max-rec th"); // set values - tolMaxRecHeaders[1].innerText = (tolerancia.MNom + ((tolerancia.MMax - tolerancia.MNom) * 0.75)).toFixed(2); - tolMaxRecHeaders[2].innerText = (tolerancia.HNom + ((tolerancia.HMax - tolerancia.HNom) * 0.75)).toFixed(2); - tolMaxRecHeaders[3].innerText = (tolerancia.SNom + ((tolerancia.SMax - tolerancia.SNom) * 0.75)).toFixed(2); - tolMaxRecHeaders[4].innerText = (tolerancia.TNom + ((tolerancia.TMax - tolerancia.TNom) * 0.75)).toFixed(2); - tolMaxRecHeaders[5].innerText = (tolerancia.BNom + ((tolerancia.BMax - tolerancia.BNom) * 0.75)).toFixed(2); + tolMaxRecHeaders[1].innerText = (tolerancia.MNom + ((tolerancia.MMax - tolerancia.MNom) * 0.75)).toFixed(3); + tolMaxRecHeaders[2].innerText = (tolerancia.HNom + ((tolerancia.HMax - tolerancia.HNom) * 0.75)).toFixed(3); + tolMaxRecHeaders[3].innerText = (tolerancia.SNom + ((tolerancia.SMax - tolerancia.SNom) * 0.75)).toFixed(3); + tolMaxRecHeaders[4].innerText = (tolerancia.TNom + ((tolerancia.TMax - tolerancia.TNom) * 0.75)).toFixed(3); + tolMaxRecHeaders[5].innerText = (tolerancia.BNom + ((tolerancia.BMax - tolerancia.BNom) * 0.75)).toFixed(3); // set nominales var tolNomHeaders = document.querySelectorAll("#tol-nominal th"); // set nominales values - tolNomHeaders[1].innerText = (tolerancia.MNom).toFixed(2); - tolNomHeaders[2].innerText = (tolerancia.HNom).toFixed(2); - tolNomHeaders[3].innerText = (tolerancia.SNom).toFixed(2); - tolNomHeaders[4].innerText = (tolerancia.TNom).toFixed(2); - tolNomHeaders[5].innerText = (tolerancia.BNom).toFixed(2); + tolNomHeaders[1].innerText = (tolerancia.MNom).toFixed(3); + tolNomHeaders[2].innerText = (tolerancia.HNom).toFixed(3); + tolNomHeaders[3].innerText = (tolerancia.SNom).toFixed(3); + tolNomHeaders[4].innerText = (tolerancia.TNom).toFixed(3); + tolNomHeaders[5].innerText = (tolerancia.BNom).toFixed(3); // set tolerancias min rec var tolMinRecHeaders = document.querySelectorAll("#tol-min-rec th") // set values - tolMinRecHeaders[1].innerText = (tolerancia.MNom - ((tolerancia.MNom - tolerancia.MMin) * 0.75)).toFixed(2); - tolMinRecHeaders[2].innerText = (tolerancia.HNom - ((tolerancia.HNom - tolerancia.HMin) * 0.75)).toFixed(2); - tolMinRecHeaders[3].innerText = (tolerancia.SNom - ((tolerancia.SNom - tolerancia.SMin) * 0.75)).toFixed(2); - tolMinRecHeaders[4].innerText = (tolerancia.TNom - ((tolerancia.TNom - tolerancia.TMin) * 0.75)).toFixed(2); - tolMinRecHeaders[5].innerText = (tolerancia.BNom - ((tolerancia.BNom - tolerancia.BMin) * 0.75)).toFixed(2); + tolMinRecHeaders[1].innerText = (tolerancia.MNom - ((tolerancia.MNom - tolerancia.MMin) * 0.75)).toFixed(3); + tolMinRecHeaders[2].innerText = (tolerancia.HNom - ((tolerancia.HNom - tolerancia.HMin) * 0.75)).toFixed(3); + tolMinRecHeaders[3].innerText = (tolerancia.SNom - ((tolerancia.SNom - tolerancia.SMin) * 0.75)).toFixed(3); + tolMinRecHeaders[4].innerText = (tolerancia.TNom - ((tolerancia.TNom - tolerancia.TMin) * 0.75)).toFixed(3); + tolMinRecHeaders[5].innerText = (tolerancia.BNom - ((tolerancia.BNom - tolerancia.BMin) * 0.75)).toFixed(3); tolMinRecHeaders[7].innerText = "Rec: " + tolerancia.AsimMax * 0.75; tolMinRecHeaders[9].innerText = "Rec: " + tolerancia.AsimMax * 0.75; // set tolerancias min var tolMinHeaders = document.querySelectorAll("#tol-min th") // set values - tolMinHeaders[1].innerText = (tolerancia.MMin).toFixed(2); - tolMinHeaders[2].innerText = (tolerancia.HMin).toFixed(2); - tolMinHeaders[3].innerText = (tolerancia.SMin).toFixed(2); - tolMinHeaders[4].innerText = (tolerancia.TMin).toFixed(2); - tolMinHeaders[5].innerText = (tolerancia.BMin).toFixed(2); + tolMinHeaders[1].innerText = (tolerancia.MMin).toFixed(3); + tolMinHeaders[2].innerText = (tolerancia.HMin).toFixed(3); + tolMinHeaders[3].innerText = (tolerancia.SMin).toFixed(3); + tolMinHeaders[4].innerText = (tolerancia.TMin).toFixed(3); + tolMinHeaders[5].innerText = (tolerancia.BMin).toFixed(3); }); } @@ -157,6 +157,10 @@ function ObtenerMediciones(po) { tolerancia = JSON.parse(tolerancia); // create new row var newRow = medicionesTable.insertRow(); + // barra + var medicionBarra = newRow.insertCell(); + medicionBarra.textContent = medicion.IDBarra; + medicionBarra.className = 'is-size-4 has-text-weight-bold'; // medicion tipo var medicionTipo = newRow.insertCell(); if (medicion.MedicionTipo === 1) { @@ -192,7 +196,7 @@ function ObtenerMediciones(po) { // g/mm var gmm = medicion.MasaUnitaria.GramosMM; gmmCell = newRow.insertCell(); - gmmCell.textContent = gmm; + gmmCell.textContent = gmm.toFixed(3); if (gmm > parseFloat(tolerancia.MMax) || gmm < parseFloat(tolerancia.MMin)) { gmmCell.className = 'is-size-4 has-text-weight-bold has-background-danger has-text-white'; } else { @@ -281,7 +285,7 @@ function ObtenerMediciones(po) { //tolerancia asimetria recomendada tolerancia.AsimRec = tolerancia.AsimMax - ((tolerancia.AsimMax) * .25) // dif asimetria del alma lado motor sup - inferior - var dif_asi_alm_motor = (medicion.AsimetriaAlma.LadoMotorSup - medicion.AsimetriaAlma.LadoMotorInf).toFixed(2); + var dif_asi_alm_motor = (medicion.AsimetriaAlma.LadoMotorSup - medicion.AsimetriaAlma.LadoMotorInf).toFixed(3); difAsimetriaAlmaLadoMotorCell = newRow.insertCell(); difAsimetriaAlmaLadoMotorCell.textContent = dif_asi_alm_motor; if (dif_asi_alm_motor > tolerancia.AsimMax || dif_asi_alm_motor < (tolerancia.AsimMax) * -1) { @@ -298,7 +302,7 @@ function ObtenerMediciones(po) { asimetriaAlmaLadoOperadorInfCell.textContent = medicion.AsimetriaAlma.LadoOperadorInf; asimetriaAlmaLadoOperadorInfCell.className = 'is-size-4 has-text-weight-bold'; // dif asimetria del alma lado operador sup - inferior - var dif_asi_alm_operador = (medicion.AsimetriaAlma.LadoOperadorSup - medicion.AsimetriaAlma.LadoOperadorInf).toFixed(2); + var dif_asi_alm_operador = (medicion.AsimetriaAlma.LadoOperadorSup - medicion.AsimetriaAlma.LadoOperadorInf).toFixed(3); difAsimetriaAlmaLadoOperadorCell = newRow.insertCell(); difAsimetriaAlmaLadoOperadorCell.textContent = dif_asi_alm_operador; if (dif_asi_alm_operador > tolerancia.AsimMax || dif_asi_alm_operador < (tolerancia.AsimMax * -1)) { diff --git a/internal/app/app.go b/internal/app/app.go index e2cc439..a8773b8 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -16,10 +16,10 @@ import ( func Run() error { // setup flags httpAddr := flag.String("bind-addr", "0.0.0.0:9100", "HTTP server address") - apiAddr := flag.String("api-addr", "mediciones-service", "REST API server address") - apiPort := flag.Int("api-port", 3000, "REST API server port") - //apiAddr := flag.String("api-addr", "10.1.152.13", "REST API server address") - //apiPort := flag.Int("api-port", 9210, "REST API server port") + //apiAddr := flag.String("api-addr", "mediciones-service", "REST API server address") + //apiPort := flag.Int("api-port", 3000, "REST API server port") + apiAddr := flag.String("api-addr", "10.1.152.13", "REST API server address") + apiPort := flag.Int("api-port", 9210, "REST API server port") logLevel := flag.String("level", "debug", "Log level") flag.Parse() // setup logger diff --git a/internal/handlers/medicion.go b/internal/handlers/medicion.go index 2f3f98c..fbc299a 100644 --- a/internal/handlers/medicion.go +++ b/internal/handlers/medicion.go @@ -90,7 +90,7 @@ func MedicionCreateHandler(client client.IMediciones) httprouter.Handle { EspesorAlma: espesorAlma, EspesoresAlas: types.EspesoresAlas{LadoMotorSup: espesorAlaT4, LadoMotorInf: espesorAlaT3, LadoOperadorSup: espesorAlaT2, LadoOperadorInf: espesorAlaT1}, AnchuraAlas: types.AnchuraAlas{LadoMotor: anchoAlaB1, LadoOperador: anchoAlaB2}, - AsimetriaAlma: types.AsimetriaAlma{LadoMotorSup: asimetriaE1, LadoMotorInf: asimetriaE2, LadoOperadorSup: asimetriaE3, LadoOperadorInf: asimetriaE4}, + AsimetriaAlma: types.AsimetriaAlma{LadoMotorSup: asimetriaE4, LadoMotorInf: asimetriaE3, LadoOperadorSup: asimetriaE2, LadoOperadorInf: asimetriaE1}, Firmada: false, Operador: operador, Enraye: enraye, diff --git a/internal/handlers/po.go b/internal/handlers/po.go index 16e89fc..620d1d1 100644 --- a/internal/handlers/po.go +++ b/internal/handlers/po.go @@ -15,7 +15,7 @@ func OrdenesProduccionListHandler(client client.IMediciones) httprouter.Handle { return func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { res, err := client.GetProductionOrders(r.Context(), types.GetProductionOrdersReq{ Sender: "mediciones-ui", - Limit: 100, + Limit: 20, TimeStamp: time.Now().UTC().Format(time.RFC3339), }) if err != nil { diff --git a/templates/mediciones.html b/templates/mediciones.html index 4f71106..ca7a82a 100644 --- a/templates/mediciones.html +++ b/templates/mediciones.html @@ -313,10 +313,10 @@ name="b2" placeholder="b2" required /> - + @@ -445,6 +445,7 @@
+ @@ -544,7 +545,7 @@ - +
Barra Muestra Hora Colada