Class AjusteController
java.lang.Object
com.deusto.coffeestack.controller.AjusteController
REST controller for registering inventory adjustments (mermas, roturas, manual adjustments).
Endpoints:
POST /api/ajustes– register a new movement (PROPIETARIO/ROOT)GET /api/ajustes– list all movements (any authenticated user)GET /api/ajustes/insumo/{insumoId}– list movements for a specific insumo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlistar()Returns the full list of inventory movements (audit log), most recent first.listarPorInsumo(Long insumoId) Returns all movements for the batches of a given insumo.org.springframework.http.ResponseEntity<MovimientoResponse> registrar(@Valid AjusteRequest request, org.springframework.security.core.userdetails.UserDetails userDetails) Registers a new inventory movement.reportePorMotivo(TipoMovimiento tipo, LocalDate desde, LocalDate hasta) Reporte agregado de mermas/ajustes agrupados por motivo y tipo.
-
Constructor Details
-
AjusteController
-
-
Method Details
-
registrar
@PostMapping @PreAuthorize("hasAnyRole(\'PROPIETARIO\', \'ROOT\')") public org.springframework.http.ResponseEntity<MovimientoResponse> registrar(@Valid @RequestBody @Valid AjusteRequest request, @AuthenticationPrincipal org.springframework.security.core.userdetails.UserDetails userDetails) Registers a new inventory movement. Returns 201 Created with the movement in the body and its URI in the Location header. -
listar
Returns the full list of inventory movements (audit log), most recent first. -
listarPorInsumo
@GetMapping("/insumo/{insumoId}") @PreAuthorize("isAuthenticated()") public List<MovimientoResponse> listarPorInsumo(@PathVariable Long insumoId) Returns all movements for the batches of a given insumo. Returns 404 if the insumo does not exist. -
reportePorMotivo
@GetMapping("/reporte-motivos") @PreAuthorize("hasAnyRole(\'PROPIETARIO\', \'ROOT\')") public List<ReporteMotivoResponse> reportePorMotivo(@RequestParam(required=false) TipoMovimiento tipo, @RequestParam(required=false) @DateTimeFormat(iso=DATE) LocalDate desde, @RequestParam(required=false) @DateTimeFormat(iso=DATE) LocalDate hasta) Reporte agregado de mermas/ajustes agrupados por motivo y tipo. Pensado para que el propietario detecte recurrencias de desperdicio y mejore procesos (issue #24).Todos los parámetros son opcionales:
tipo– filtra por un tipo concreto (MERMA, ROTURA, …).desde– fecha inicial (inclusive). Se interpreta a las 00:00.hasta– fecha final (inclusive). Se interpreta al final del día.
-