wip
This commit is contained in:
parent
72f0c0d273
commit
99a4cc7b7a
105
TODO
105
TODO
@ -1,49 +1,56 @@
|
|||||||
Defining template:
|
Grupo6 string `json:"grupo6"`
|
||||||
{{ define “template_name” }} {{ end }}
|
Po int `json:"po" gorm:"index"`
|
||||||
|
Co int `json:"co"`
|
||||||
Using template:
|
Colada string `json:"colada"`
|
||||||
{{ template “template_name” . }}
|
Calidad string `json:"calidad"`
|
||||||
|
Matnr string `json:"matnr"`
|
||||||
Block:
|
Dibujo int `json:"dibujo"`
|
||||||
{{ block “content” . }} {{ end }}
|
Operador string `json:"operador"`
|
||||||
|
Serie int `json:"serie"`
|
||||||
Is equivalent to => {{ template “content” . }} {{ define “content” }} {{ end }}
|
Nromatricula string `gorm:"primaryKey" json:"nromatricula"`
|
||||||
|
NroBulto string `json:"nro_bulto"`
|
||||||
If:
|
EtiquetaDoble string `json:"etiqueta_doble"`
|
||||||
{{ if var }} //… {{ else if var }} //… {{ else }} //… {{ end }}
|
Fecha int `json:"fecha"`
|
||||||
|
Turno string `json:"turno"`
|
||||||
Assignment:
|
Observacion1 string `json:"observacion1"`
|
||||||
{{ $first_name := “arash” }} {{ $first_name = .Name }}
|
Observacion2 string `json:"observacion2"`
|
||||||
|
Observacion3 string `json:"observacion3"`
|
||||||
With:
|
PaqueteLongitud float64 `json:"paquete_longitud"`
|
||||||
{{ with . Firstname }} // . refers to Firstname {{ end }}
|
PaqueteAncho int `json:"paquete_ancho"`
|
||||||
|
PaqueteAlto float64 `json:"paquete_alto"`
|
||||||
{{ with $ firstname := .Firstname }} // . and $firstname both refer to Firstname {{ end }}
|
PaquetePeso int `json:"paquete_peso"`
|
||||||
|
PaqueteNroSecciones int `json:"paquete_nro_secciones"`
|
||||||
Range:
|
PaqueteNroMantos int `json:"paquete_nro_mantos"`
|
||||||
{{ range .Users }} {{ .Firstname }} {{ end }}
|
PaqueteNroSeccManto int `json:"paquete_nro_secc_manto"`
|
||||||
|
SeccionTipo string `gorm:"index" json:"seccion_tipo"`
|
||||||
{{ range $user := .Users }} {{ .Firstname }} {{ $user.Firstname }} {{ else }} No users found {{ end }}
|
SeccionLongitud int `json:"seccion_longitud"`
|
||||||
|
SeccionAncho float64 `json:"seccion_ancho"`
|
||||||
{{ range $index, $user := .Users }} {{ end }}
|
SeccionAlto float64 `json:"seccion_alto"`
|
||||||
|
Idioma string `json:"idioma"`
|
||||||
Functions:
|
Destino int `json:"destino"`
|
||||||
{{ if and cond1 cond2 … }}
|
Hora int `json:"hora"`
|
||||||
|
Horario int `json:"horario"`
|
||||||
{{ if or cond1 cond2 … }}
|
Inst string `json:"inst"`
|
||||||
|
Tren int `json:"tren"`
|
||||||
{{ if not cond }}
|
Normed string `json:"normed"`
|
||||||
|
Norpro string `json:"norpro"`
|
||||||
{{ len var }}
|
Nortol string `json:"nortol"`
|
||||||
|
Spras string `json:"spras"`
|
||||||
tmpl, _ := template.New(“template_name”).Parse(“...”)
|
Statu int `json:"statu"`
|
||||||
|
Crlf string `json:"crlf"`
|
||||||
tmpl.Name() => name of current template
|
Maquina int `json:"maquina"`
|
||||||
|
Padre string `json:"padre"`
|
||||||
tmpl.Execute(...) => execute current template
|
Paqpadre string `json:"paqpadre"`
|
||||||
|
RelevantTime string `json:"relevant_time"`
|
||||||
tmpl.ExecuteTemplate(...) => execute template by name
|
Desvio float64 `json:"desvio"`
|
||||||
|
Pesoteorico float64 `json:"pesoteorico"`
|
||||||
tmpl = tmpl.Lookup(“template_name”) => change current template
|
PesoteoricoReal float64 `json:"pesoteorico_real"`
|
||||||
|
DesvioTeoricoReal float64 `json:"desvio_teorico_real"`
|
||||||
tmpl.Templates() => Get defined templates
|
FechaImpresion string `json:"fecha_impresion"`
|
||||||
|
PesoNivel1 float64 `json:"peso_nivel1"`
|
||||||
|
L3Sended bool `json:"l3_sended,omitempty"`
|
||||||
|
Confirmed bool `json:"confirmed,omitempty"`
|
||||||
|
SAP bool `json:"sap,omitempty"`
|
||||||
|
CreatedAt time.Time `gorm:"->;<-:create" json:"createdat,omitempty"`
|
||||||
|
UpdatedAt time.Time `json:"updatedat,omitempty"`
|
||||||
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedat,omitempty"`
|
@ -4,12 +4,16 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
|
"git.espin.casa/albert/cml04-falcon-ui/helper"
|
||||||
"git.espin.casa/albert/cml04-falcon-ui/storage"
|
"git.espin.casa/albert/cml04-falcon-ui/storage"
|
||||||
|
"git.espin.casa/albert/cml04-falcon-ui/types"
|
||||||
"github.com/julienschmidt/httprouter"
|
"github.com/julienschmidt/httprouter"
|
||||||
)
|
)
|
||||||
|
|
||||||
func BundleHandler(storage storage.Storager) httprouter.Handle {
|
func BundleHandler(storage storage.Storager) httprouter.Handle {
|
||||||
return func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
return func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
|
|
||||||
|
if r.Method == http.MethodGet {
|
||||||
t, _ := template.ParseFiles("templates/base.html", "templates/bundle.html")
|
t, _ := template.ParseFiles("templates/base.html", "templates/bundle.html")
|
||||||
err := t.Execute(w, nil)
|
err := t.Execute(w, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -17,4 +21,25 @@ func BundleHandler(storage storage.Storager) httprouter.Handle {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if r.Method == http.MethodPost {
|
||||||
|
// barcodes holder
|
||||||
|
Bundles := []types.BundleData{}
|
||||||
|
// parse form data from formulary
|
||||||
|
if err := r.ParseForm(); err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
}
|
||||||
|
// barcode
|
||||||
|
codigo := r.FormValue("codigo")
|
||||||
|
// date range
|
||||||
|
fechas := r.FormValue("fechas")
|
||||||
|
// get range dates
|
||||||
|
inicio, final, err := helper.Dates(fechas)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,4 +18,5 @@ func CreateRoutes(r *httprouter.Router, storage storage.Storager) {
|
|||||||
r.GET("/labels", handlers.LabelsHandler())
|
r.GET("/labels", handlers.LabelsHandler())
|
||||||
r.GET("/standards", handlers.StandardsHandler(storage))
|
r.GET("/standards", handlers.StandardsHandler(storage))
|
||||||
r.GET("/bundle", handlers.BundleHandler(storage))
|
r.GET("/bundle", handlers.BundleHandler(storage))
|
||||||
|
r.POST("/bundle", handlers.BundleHandler(storage))
|
||||||
}
|
}
|
||||||
|
@ -41,14 +41,67 @@
|
|||||||
<nav class="panel is-link">
|
<nav class="panel is-link">
|
||||||
<p class="panel-heading"><i class="fas fa-box" aria-hidden="true"></i> Busqueda Paquetes</p>
|
<p class="panel-heading"><i class="fas fa-box" aria-hidden="true"></i> Busqueda Paquetes</p>
|
||||||
<div class="panel-block">
|
<div class="panel-block">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
{{ if .}}
|
{{ if .}}
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<nav class="panel is-link">
|
<nav class="panel is-link">
|
||||||
<p class="panel-heading"><i class="fas fa-box" aria-hidden="true"></i> Busqueda Paquetes</p>
|
<p class="panel-heading"><i class="fas fa-box" aria-hidden="true"></i> Listado Paquetes</p>
|
||||||
<div class="panel-block">
|
<div class="panel-block">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><abbr title="Unidad de almacén">UA</abbr></th>
|
||||||
|
<th>PO</th>
|
||||||
|
<th>CO</th>
|
||||||
|
<th>Colada</th>
|
||||||
|
<th>Calidad</th>
|
||||||
|
<th>Código SAP</th>
|
||||||
|
<th>Producto</th>
|
||||||
|
<th>Peso</th>
|
||||||
|
<th>Desvío</th>
|
||||||
|
<th>Confirmado</th>
|
||||||
|
<th>Nivel 3</th>
|
||||||
|
<th>SAP</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th><abbr title="Unidad de almacén">UA</abbr></th>
|
||||||
|
<th>PO</th>
|
||||||
|
<th>CO</th>
|
||||||
|
<th>Colada</th>
|
||||||
|
<th>Calidad</th>
|
||||||
|
<th>Código SAP</th>
|
||||||
|
<th>Producto</th>
|
||||||
|
<th>Peso</th>
|
||||||
|
<th>Desvío</th>
|
||||||
|
<th>Confirmado</th>
|
||||||
|
<th>Nivel 3</th>
|
||||||
|
<th>SAP</th>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
<tbody>
|
||||||
|
{{ range . }}
|
||||||
|
<tr>
|
||||||
|
<td><a href="">{{ .Nromatricula }}</a></td>
|
||||||
|
<td><a href="">{{ .Po }}</a></td>
|
||||||
|
<td><a href="">{{ .Co }}</a></td>
|
||||||
|
<td>{{ .Colada }}</td>
|
||||||
|
<td>{{ .Calidad }}</td>
|
||||||
|
<td>{{ .Matnr }}</td>
|
||||||
|
<td>{{ .SeccionTipo }}</td>
|
||||||
|
<td>{{ .PaquetePeso }}</td>
|
||||||
|
<td>{{ .Desvio }}</td>
|
||||||
|
<td>{{ .L3Sended }}</td>
|
||||||
|
<td>{{ .Confirmed }}</td>
|
||||||
|
<td>{{ .SAP }}</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user