wip
This commit is contained in:
parent
529751ae38
commit
fbc6a18b0e
@ -13,12 +13,12 @@ func Dates(dr string) (start, finish time.Time, err error) {
|
||||
inicio = strings.TrimSpace(inicio)
|
||||
final = strings.TrimSpace(final)
|
||||
// parse start date
|
||||
start, err = time.Parse("02/01/2006 15:04", inicio)
|
||||
start, err = time.ParseInLocation("02/01/2006 15:04", inicio, time.Local)
|
||||
if err != nil {
|
||||
return time.Time{}, time.Time{}, err
|
||||
}
|
||||
// parse finish date
|
||||
finish, err = time.Parse("02/01/2006 15:04", final)
|
||||
finish, err = time.ParseInLocation("02/01/2006 15:04", final, time.Local)
|
||||
if err != nil {
|
||||
return time.Time{}, time.Time{}, err
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ type Storager interface {
|
||||
Barcode(ctx context.Context, reading string) (barcode *types.Barcode, err error)
|
||||
ListBarcode(ctx context.Context, lb types.LoadingBed, inicio, final time.Time) (barcodes []types.Barcode, err error)
|
||||
Bundle(ctx context.Context, ua string) (bundle *types.BundleData, err error)
|
||||
ListBundle(ctx context.Context, lb types.LoadingBed, inicio, final time.Time) (bundles []types.BundleData, err error)
|
||||
ListBundle(ctx context.Context, lb types.LoadingBed, inicio, final time.Time, confirmed bool) (bundles []types.BundleData, err error)
|
||||
}
|
||||
|
||||
type storage struct {
|
||||
@ -32,13 +32,13 @@ type storage struct {
|
||||
}
|
||||
|
||||
// ListBundle implements Storager.
|
||||
func (s *storage) ListBundle(ctx context.Context, lb types.LoadingBed, inicio time.Time, final time.Time) (bundles []types.BundleData, err error) {
|
||||
func (s *storage) ListBundle(ctx context.Context, lb types.LoadingBed, inicio time.Time, final time.Time, confirmed bool) (bundles []types.BundleData, err error) {
|
||||
if lb == types.ALL {
|
||||
if err := s.db.Where("created_at >= ? and created_at < ?", inicio, final).Find(&bundles).WithContext(ctx).Error; err != nil {
|
||||
if err := s.db.Where("created_at >= ? and created_at < ? and confirmed = ?", inicio, final, confirmed).Find(&bundles).WithContext(ctx).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
if err := s.db.Where("loading_bed = ? and created_at >= ? and created_at < ?", lb, inicio, final).Find(&bundles).WithContext(ctx).Error; err != nil {
|
||||
if err := s.db.Where("substr(nromatricula,1,3)=? and created_at >= ? and created_at < ? and confirmed = ?", types.MapQueryBed[lb], inicio, final, confirmed).Find(&bundles).WithContext(ctx).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,13 @@
|
||||
|
||||
<body>
|
||||
<div class="notification is-link banner">
|
||||
<p>
|
||||
<p>FALCON
|
||||
<figure class="image is-64x64">
|
||||
<img src="/assets/img/falcon-transparent-white.png" alt="white falcon" />
|
||||
</figure>
|
||||
FALCON</p>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{{ template "body" . }}
|
||||
|
||||
</body>
|
||||
|
@ -79,6 +79,19 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-block">
|
||||
<div class="field">
|
||||
<label class="label">Selección</label>
|
||||
<div class="control">
|
||||
<p class="control has-icons-left">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="confirmed" id="confirmed"/>
|
||||
Confirmado
|
||||
</label>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-block">
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button is-link is-outlined">
|
||||
@ -104,7 +117,6 @@
|
||||
<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>
|
||||
@ -113,6 +125,7 @@
|
||||
<th><abbr title="Paquete confirmado">Conf.</abbr></th>
|
||||
<th><abbr title="Nivel 3">N3</abbr></th>
|
||||
<th>SAP</th>
|
||||
<th>Fecha</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
@ -120,7 +133,6 @@
|
||||
<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>
|
||||
@ -129,6 +141,7 @@
|
||||
<th><abbr title="Paquete confirmado">Conf.</abbr></th>
|
||||
<th><abbr title="Nivel 3">N3</abbr></th>
|
||||
<th>SAP</th>
|
||||
<th>Fecha</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
@ -137,15 +150,15 @@
|
||||
<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>{{ .FormatDesvio }}</td>
|
||||
<td>{{ .L3Sended }}</td>
|
||||
<td>{{ .Confirmed }}</td>
|
||||
<td>{{ .SAP }}</td>
|
||||
<td>{{if .L3Sended }} Sí {{ else }} No {{ end }}</td>
|
||||
<td>{{if .Confirmed }} Sí {{ else }} No {{ end }}</td>
|
||||
<td>{{if .SAP }} Sí {{ else }} No {{ end }}</td>
|
||||
<td>{{ .FormatCreatedAt }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
|
@ -28,6 +28,11 @@ var MapFormatBed = map[LoadingBed]string{
|
||||
ALL: "TODOS",
|
||||
}
|
||||
|
||||
var MapQueryBed = map[LoadingBed]string{
|
||||
ATA12: "940",
|
||||
ATA345: "945",
|
||||
}
|
||||
|
||||
type Barcode struct {
|
||||
Barcode string `gorm:"primaryKey"`
|
||||
LoadingBed LoadingBed
|
||||
|
@ -73,3 +73,17 @@ func (BundleData) TableName() string {
|
||||
func (b *BundleData) FormatDesvio() string {
|
||||
return fmt.Sprintf("%.3f", b.Desvio)
|
||||
}
|
||||
|
||||
func (b *BundleData) FormatSerie() string {
|
||||
if b.Serie == 1 {
|
||||
return "AUTO"
|
||||
} else if b.Serie == 9 {
|
||||
return "REPT."
|
||||
} else {
|
||||
return "MANUAL"
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BundleData) FormatCreatedAt() string {
|
||||
return b.CreatedAt.Format("02/01/2006 15:04:03")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user