Class ScanReceiptService

java.lang.Object
org.bgerp.plugin.inventoru.service.ScanReceiptService

public class ScanReceiptService extends Object
Receiving a box of individually identified equipment by scanner — a batch of xPON ONU labels, each carrying up to three codes (P-SN → serial_number, the GPON SN the OLT authenticates by; MAC → mac_address; the vendor "SN" → a configured parameter), placed on one store under one nomenclature position in one request. The manual counterpart of DeviceImportService#apply without a file: every row goes through DeviceAccountingService.save(Device, Device, int, DeviceAccountingService.Source, String), which decides receipt/transfer/refusal and writes the movement the balance needs — this class does not touch inventoru_balance or inventoru_movement directly. Two-phase like MovementAction.recordMultiple, not row-by-row like DeviceImportService#apply: a box is one physical delivery, and a mistake on one label must not leave the other nineteen half-received — either every clean row lands, or none does, and the refusal names every bad row by its code (a batch of one position repeats its title N times, the code is what tells the rows apart).
  • Constructor Details

    • ScanReceiptService

      public ScanReceiptService(Connection con)
  • Method Details

    • apply

      public ScanReceiptService.Result apply(int storeId, int itemId, List<ScanReceiptService.Row> rows, int serialParamId, int userId) throws SQLException, BGMessageException
      Validates every row, then writes every row — never some of each.
      Parameters:
      serialParamId - parameter holding the vendor "SN", inventoru:device.serialParamId; 0 — not configured, a row naming an SN is refused rather than silently dropping it
      Throws:
      BGMessageException - refused; nothing has been written. The message lists every bad row by its code, semicolon separated.
      SQLException