From 63f01c253ff998702d357c55e66b653f02b11871 Mon Sep 17 00:00:00 2001 From: fede Date: Mon, 31 Aug 2026 00:35:33 -0300 Subject: [PATCH] feat: actualizado diagrama de dominio --- back/models/comprobante.go | 10 +++---- back/models/remito.go | 28 ++++++++++++++++++++ back/models/remito_detalle.go | 9 +++++++ docs/diagramas/plantuml/D-CLA-DOM-001.org | 32 ++++++++++++++++++++++- docs/diagramas/png/D-CLA-DOM-001.png | 4 +-- 5 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 back/models/remito.go create mode 100644 back/models/remito_detalle.go diff --git a/back/models/comprobante.go b/back/models/comprobante.go index b669d5f..25f5159 100644 --- a/back/models/comprobante.go +++ b/back/models/comprobante.go @@ -9,9 +9,9 @@ import ( // este lo uso de base para los distintos tipos de comprobantes type Comprobante struct { gorm.Model - Numero string `gorm:"size:50;not null" json:"numero"` - Estado string `gorm:"type:varchar(20);not null" json:"estado"` - Total float64 `gorm:"type:decimal(15,2);not null" json:"total"` - ResponsableID uint `gorm:"column:usuarioID"` - Responsable models_seguridad.Usuario `gorm:"foreignKey:usuarioID" json:"usuario"` + // Numero string `gorm:"size:50;not null" json:"numero"` + Estado string `gorm:"type:varchar(20);not null" json:"estado"` + Total float64 `gorm:"type:decimal(15,2);not null" json:"total"` + ResponsableID uint `gorm:"column:usuarioID"` + Responsable models_seguridad.Usuario `gorm:"foreignKey:usuarioID" json:"usuario"` } diff --git a/back/models/remito.go b/back/models/remito.go new file mode 100644 index 0000000..134efd5 --- /dev/null +++ b/back/models/remito.go @@ -0,0 +1,28 @@ +package models + +import ( + "time" + + "gorm.io/datatypes" +) + +type Remito struct { + Comprobante + FechaEmision time.Time `gorm:"not null" json:"fechaEmision"` + TipoOperacion TipoOperacion `gorm:"type:varchar(20);not null" json:"tipoOperacion"` + EmisorID uint `gorm:"not null" json:"emisorId"` + ReceptorID uint `gorm:"not null" json:"receptorId"` + + AlmacenOrigenID *uint `gorm:"column:almacen_origen_id" json:"almacenOrigenId,omitempty"` + AlmacenOrigen *Almacen `gorm:"foreignKey:AlmacenOrigenID" json:"almacenOrigen,omitempty"` + + Detalles datatypes.JSONSlice[RemitoDetalle] `gorm:"type:json" json:"detalles,omitempty"` +} + +type TipoOperacion string + +const ( + OperacionCompra TipoOperacion = "COMPRA" + OperacionVenta TipoOperacion = "VENTA" + OperacionMovimiento TipoOperacion = "MOVIMIENTO" +) diff --git a/back/models/remito_detalle.go b/back/models/remito_detalle.go new file mode 100644 index 0000000..77fa52b --- /dev/null +++ b/back/models/remito_detalle.go @@ -0,0 +1,9 @@ +package models + +type RemitoDetalle struct { + ProductoID uint `json:"productoId"` + CantidadEsperada float64 `json:"cantidadEsperada,omitempty"` + CantidadRecibida float64 `json:"cantidadRecibida"` + UnidadMedida string `json:"unidadMedida"` + Observacion string `json:"observacion,omitempty"` +} diff --git a/docs/diagramas/plantuml/D-CLA-DOM-001.org b/docs/diagramas/plantuml/D-CLA-DOM-001.org index 68ab462..e928783 100644 --- a/docs/diagramas/plantuml/D-CLA-DOM-001.org +++ b/docs/diagramas/plantuml/D-CLA-DOM-001.org @@ -40,7 +40,6 @@ end note class "Comprobante" as CBT { -Numero: string Estado: string Total: float64 ResponsableID: uint @@ -56,6 +55,37 @@ Responsable: Usuario ' end note '/ +class "Remito" as RMT { +FechaEmision: time.Time +TipoOperacion: TipoOperacion +EmisorID: uint +ReceptorID: uint +AlmacenOrigenID *uint +AlmacenOrigen *Almacen +Detalles: RemitoDetalle[] +} + +Remito <|-- Comprobante +Remito "*" --> "1" TIO +Remito "1" --> "1..*" RemitoDetalle +Remito "1" --> "0..2" Almacen +Remito "1" --> "0..1" Cliente : Receptor +Remito "1" --> "0..1" Proveedor : Emisor + +class "RemitoDetalle" as DRMT { +ProductoID: uint +CantidadEsperada: float64 +CantidadRecibida: float64 +UnidadMedida: string +Observacion: string +} + +enum "TipoOperacion" as TIO { +COMPRA +VENTA +INTERNO +} + class "Descuento" as DS { Nombre: string Descripcion: string diff --git a/docs/diagramas/png/D-CLA-DOM-001.png b/docs/diagramas/png/D-CLA-DOM-001.png index 7948f22..f484633 100644 --- a/docs/diagramas/png/D-CLA-DOM-001.png +++ b/docs/diagramas/png/D-CLA-DOM-001.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:615c6507951f1e8f44c893bfb1bd94767a931ad67cecd1f8969e624b12869267 -size 245872 +oid sha256:07778eaaa35cb7d1bde55d74212a67045a851bfac454709fce906398907b98c5 +size 301395