Class StoreDAO

java.lang.Object
ru.bgcrm.dao.CommonDAO
org.bgerp.plugin.inventoru.dao.StoreDAO

public class StoreDAO extends CommonDAO
DAO for Store (warehouses). Also handles inventoru_balance read operations.
  • Constructor Details

  • Method Details

    • getList

      public List<Store> getList(boolean includeDeleted) throws SQLException
      Throws:
      SQLException
    • get

      public Store get(int id) throws SQLException
      Throws:
      SQLException
    • update

      public void update(Store store, int userId) throws SQLException
      Throws:
      SQLException
    • delete

      public void delete(int id, int userId) throws SQLException
      Throws:
      SQLException
    • restore

      public void restore(int id) throws SQLException
      Undoes a delete: it is a soft one, and until now there was no way back from it.
      Throws:
      SQLException
    • getIdsByOwner

      public Set<Integer> getIdsByOwner(int userId) throws SQLException
      Returns IDs of non-deleted stores personally owned by the given user (store.user_id).
      Throws:
      SQLException
    • getIdsByEditGroupIds

      public Set<Integer> getIdsByEditGroupIds(Set<Integer> groupIds) throws SQLException
      Returns IDs of non-deleted stores whose edit_group_id is one of the given groups — e.g. a "кладовщик" group shared by several users managing the same store.
      Throws:
      SQLException
    • getByParamNotEmpty

      public Map<Integer,String> getByParamNotEmpty(int paramId) throws SQLException
      Stores carrying a value in the given parameter — how a store says which 1C base it belongs to: the connector names the parameter, a store with something in it takes part in that exchange. Deleted stores are left out (they would be polled every cycle and revive their pending rows), and so are empty values — the kernel usually deletes an emptied value, but rows written straight into the table by hand outlive that.
      Returns:
      store id to the value, in no particular order
      Throws:
      SQLException
    • getIdByExtIdParam

      public int getIdByExtIdParam(int extIdParamId, String extId) throws SQLException
      Throws:
      SQLException
    • getAvailable

      public BigDecimal getAvailable(int storeId, int itemId) throws SQLException
      Gets available (quantity - reserved) balance for an item in a store. Returns 0 if no balance record exists.
      Throws:
      SQLException
    • getCurrentQuantity

      public BigDecimal getCurrentQuantity(int storeId, int itemId) throws SQLException
      Gets the raw recorded quantity (not quantity-reserved) for an item in a store — the baseline an inventory-count correction (adjustment movement) is computed against. Returns 0 if no balance record exists.
      Throws:
      SQLException
    • fromRs

      public static Store fromRs(ResultSet rs) throws SQLException
      Throws:
      SQLException