Interface DbQueryRepository

All Known Implementing Classes:
OracleDbQueryRepository

public interface DbQueryRepository
Repository interface for querying WMS data from Oracle database.

This interface provides clean boundaries for database access and allows for different implementations (real Oracle queries, test mocks, etc.).

All query failures are surfaced as typed runtime exceptions for consistent CLI/GUI handling.

  • Method Details

    • findShipmentWithLpnsAndLineItems

      Shipment findShipmentWithLpnsAndLineItems(String shipmentId)
      Retrieves a complete shipment with all LPNs and line items.

      This is a read-only operation that gathers: - Shipment header information (destination, carrier, dates) - All LPNs (pallets) tied to this shipment - All line items within each LPN - Staging location for routing decisions

      Parameters:
      shipmentId - the shipment identifier
      Returns:
      the complete shipment with all associated data
      Throws:
      WmsDbConnectivityException - if connection or query execution fails
      IllegalArgumentException - if shipmentId is null or empty
    • shipmentExists

      boolean shipmentExists(String shipmentId)
      Validates that a shipment exists and has at least one LPN.

      Lightweight check to verify shipment is printable without fetching all associated data.

      Parameters:
      shipmentId - the shipment identifier
      Returns:
      true if shipment exists and has at least one LPN, false otherwise
      Throws:
      WmsDbConnectivityException - if connection or query execution fails
      IllegalArgumentException - if shipmentId is null or empty
    • getStagingLocation

      String getStagingLocation(String shipmentId)
      Returns the staging location for a shipment.

      Used for printer routing decisions. All LPNs in a shipment should be in the same staging location.

      Parameters:
      shipmentId - the shipment identifier
      Returns:
      the staging location (e.g., "ROSSI", "OFFICE"), or null if not found
      Throws:
      WmsDbConnectivityException - if connection or query execution fails
      IllegalArgumentException - if shipmentId is null or empty
    • findShipmentSkuFootprints

      List<ShipmentSkuFootprint> findShipmentSkuFootprints(String shipmentId)
      Retrieves shipment-level SKU totals with footprint maintenance data.

      Data is sourced from shipment lines plus PRTFTP / PRTFTP_DTL to provide units-per-case, units-per-pallet, and pallet dimensions for planning.

      Parameters:
      shipmentId - the shipment identifier
      Returns:
      one row per SKU in the shipment
    • findCarrierMoveStops

      List<CarrierMoveStopRef> findCarrierMoveStops(String carrierMoveId)
      Resolves shipment rows for a carrier move using stop assignments.

      Rows are expected to be sorted by stop sequence and then shipment ID.

      Parameters:
      carrierMoveId - carrier move identifier
      Returns:
      stop-mapped shipment rows for the carrier move
    • findRailStopsByTrainId

      List<RailStopRecord> findRailStopsByTrainId(String trainId)
      Resolves train/load rows for rail label generation from live WMS rail receive tables.
      Parameters:
      trainId - full train ID (example: JC03032026)
      Returns:
      flattened rail stop rows with short-code items
    • findRailFootprintsByShortCode

      Map<String,List<RailFootprintCandidate>> findRailFootprintsByShortCode(List<String> shortCodes)
      Resolves WMS footprint candidates keyed by short code.

      Some short codes may map to multiple item numbers; callers are expected to apply deterministic conflict handling and diagnostics.

      Parameters:
      shortCodes - short code values from rail rows
      Returns:
      map of short code to candidate rows
    • close

      void close()
      Closes the repository and releases any resources.

      Implementors must ensure underlying connections are closed properly.