Class ImportPendingDAO

java.lang.Object
ru.bgcrm.dao.CommonDAO
org.bgerp.plugin.inventory.sync1c.dao.ImportPendingDAO

public class ImportPendingDAO extends CommonDAO
DAO for inventory_sync1c_import_pending — pending stock balance imports from 1C.
  • Constructor Details

    • ImportPendingDAO

      public ImportPendingDAO(Connection con)
  • Method Details

    • upsert

      public void upsert(int instanceId, int ewId, int storeId, int itemId, BigDecimal quantity) throws SQLException
      Upserts a pending record by (ew_id, item_id). If a record already exists (any status), it is reset to pending with the new quantity.
      Throws:
      SQLException
    • getListForUser

      public List<ImportPending> getListForUser(int userId) throws SQLException
      Returns all pending records for the given user (via engineer warehouse userId).
      Throws:
      SQLException
    • getListForInstance

      public List<ImportPending> getListForInstance(int instanceId) throws SQLException
      Returns all pending records for the given 1C instance (admin view).
      Throws:
      SQLException
    • apply

      public void apply(int id, int userId) throws SQLException
      Applies a pending record: upserts inventory_balance.quantity and marks as applied. Uses a single INSERT...SELECT to avoid an extra round-trip.
      Throws:
      SQLException
    • applyAll

      public int applyAll(List<ImportPending> list, int userId) throws SQLException
      Applies all pending records from the given list.
      Throws:
      SQLException
    • reject

      public void reject(int id) throws SQLException
      Rejects a pending record.
      Throws:
      SQLException