psdi.app.inventory

Class InvBalances

  • java.lang.Object
  • All Implemented Interfaces:
    java.rmi.Remote, InvBalancesRemote, MboConstants, MboRemote, MaxRemoteProxy


    public class InvBalances
    extends Mbo
    implements InvBalancesRemote
    Mbo object to represent InvBalances.

    See Inventory Package description.

    This is a site level object.

    The key attribute(s) in this object are as follows: SiteId,ItemSetID, Itemnum, Location, Binnum, Lotnum

    The attributes in this object are as follows:

    Attribute NameDescription
    AdjustedPhysCntNon-persistent attribute used to maintain new physical count for the item in the bin. Editable for an existing InvBalances object. If value is provided, an Adjust Physcial Count function will take place and the object's PhysCnt column will be updated to the new count. See PhysCnt for more information.
    AdjustedPhysCntDateNon-persistent attribute used to maintain new physical count date for the item in the bin. Editable for an existing InvBalances object. If value is provided and the new physical count is also provided, an Adjust Physcial Count function will take place and the object's PhysCntDate column will be updated to the new date. See PhysCntDate for more information.
    BinnumBin number of the storage location. One of four members of this object's key. This attribute is not required. See Inventory.Binnum.
    CurbalCurrent balances at this storage location.
    ItemnumInventory Item Number. One of four members of this object's key. This attribute is required.
    ItemSetIDIdentifier of the itemset identifier for this object.
    Ldkeyno description,remarks, or memo columns. To be removed.
    LocationThis inventory item's storeroom location. One of four members of this object's key. This attribute is required.
    Lotnum  Lot Number of the item at the storage location. One of four members of this object's key. This is a required attribute for a lotted item. This is a read-only attribute for an item that is not lotted. Item.Lottype determines whether or not this is a lotted item.
    OrgIdIdentifier of the organization for this object.
    PhysCntBalance from last physical count at this storage location.
    PhysCntDateDate of last physical count at this storage location.
    ReconciledFlag to indicate whether or not the balance has been reconciled.
    ShelfLifeNon-persistent attribute used to maintain InvLot.ShelfLife through the InvBalances object. For lot-tracking items only. Item.Lottype determines whether or not this is a lotted item. See the ShelfLife attribute defined in ShelfLife for more information.
    SiteIdIdentifier of the site for this object.
    UseByNon-persistent attribute used to maintain InvLot.UseBy through the InvBalances object. For lot-tracking items only. Item.Lottype determines whether or not this is a lotted item. See the UseBy attribute defined in UseBy for more information.
    See Also:
    MatRecTrans, MatUseTrans, Inventory
    • Field Detail

      • distinctBinSet

        public static MboSetRemote distinctBinSet
        stores the set of distinct bins from the InvBalances table from the InvBalances table or binsHash. This set is used to populate bin lookups.
    • Constructor Detail

      • InvBalances

        public InvBalances(MboSet ms)
                    throws MXException,
                           java.rmi.RemoteException
        InvBalances Constructor Construct the InvBalances object
        Parameters:
        ms - (The calling MBOSet)
        Throws:
        MXException
        java.rmi.RemoteException
    • Method Detail

      • init

        public void init()
                  throws MXException
        Initialization routine.
        Set field flags for attributes that are always readonly as well as those fields which are editable only during insert.
        Overrides:
        init in class Mbo
        Parameters:
        none -
        Throws:
        none
        MXException
      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Sets the default the values for a new InvBalance record. The table below shows the default values for each of the attributes listed.
        Attribute NameAttribute Value
        itemnumCurrent itemnum
        itemsetidCurrent itemsetid
        locationCurrent location
        reconciledfalse
        curbal0(zero)
        physcnt0(zero)
        physcntdateCurrent date

        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Parameters:
        none -
        Throws:
        MXApplicationException -
        GROUPKEYREASON
        inventoryinvBalNoAdd if the owner of this object is not Inventory
        MXException
        java.rmi.RemoteException
      • adjustCurrentBalance

        public MboRemote adjustCurrentBalance(double newBalance,
                                              java.lang.String controlacc,
                                              java.lang.String shrinkageacc)
                                       throws MXException,
                                              java.rmi.RemoteException
        Adjusts the current balance.
        Parameters:
        newBalance - The new balance
        controlacc - control account
        shrinkageacc - shrinkage account
        Returns:
        The InvTrans record that was added during this transaction
        Throws:
        MXApplicationException -
        GROUPKEYREASON
        inventoryadjCurBalItemRotating if the item is rotating
        inventoryadjCurBalNoChange if there is no change in the balance
        MXException
        java.rmi.RemoteException
      • reconcileBalances

        public MboRemote reconcileBalances()
                                    throws MXException,
                                           java.rmi.RemoteException
        Reconciles balances is done at the bin/lot level.
        The new current balance is determined by taking into account any issues, transfers, receipts and returns that may have taken place between the time of the physical count and the time of the reconcile.
        The reconcile routine will only apply to records in INVBALANCES which have RECONCILED = N.
         The Current ( Expected ) Balance
           = Physical Count (INVBALANCES.PHYSCNT)
           + Transfers In (after the physical count date)
           - Transfers Out (after the physical count date)
           + Returns (after the physical count date)
           - Issues (after the physical count date).
         
        Specified by:
        reconcileBalances in interface InvBalancesRemote
        Parameters:
        none -
        Returns:
        Returns the InvTrans record that was added during this transaction
        Throws:
        MXApplicationException -
        GROUPKEYREASON
        inventoryinvbalCannotReconcile if the InvBalance record has already been reconciled
        MXException
        java.rmi.RemoteException
        See Also:
        InvBalances.reconcileBalances()
      • canDelete

        public void canDelete()
                       throws MXException,
                              java.rmi.RemoteException
        Checks whether this object can be deleted.
        Overrides:
        canDelete in class Mbo
        Throws:
        MXAccessException
        MXApplicationException -
        GROUPKEYREASON
        accessnotauthorized if the owner is not Inventory
        inventorynoDeleteInvBal if the balance is greater than zero for this set
        MXException
        java.rmi.RemoteException
      • setAutoCreateInvLot

        public void setAutoCreateInvLot(boolean flag)
                                 throws MXException,
                                        java.rmi.RemoteException
        For a lotted item,returns true if invLot is to be automatically created or returns false if invlot is not be be automatically created.
        Specified by:
        setAutoCreateInvLot in interface InvBalancesRemote
        Parameters:
        flag - true or false to indicate if an invlot is to be automatically created.
        Throws:
        none
        MXException
        java.rmi.RemoteException
        See Also:
        InvBalances.setAutoCreateInvLot(boolean)
      • appValidate

        public void appValidate()
                         throws MXException,
                                java.rmi.RemoteException
        last minute validate before save(). One can not enter same combination of itemnum/location/binnum/lotnum for a given site.
        Overrides:
        appValidate in class Mbo
        Throws:
        invbalAlreadyExists
        MXException
        java.rmi.RemoteException
      • save

        public void save()
                  throws MXException,
                         java.rmi.RemoteException
        Saves the invbalances record if it is created; for a lotted item, creates invlot record if the lot number does not exist.
        Calls super.save() after working on the other objects.
        Overrides:
        save in class Mbo
        Parameters:
        none -
        Throws:
        none
        MXException
        java.rmi.RemoteException
      • getBins

        protected MboSetRemote getBins()
                                throws MXException,
                                       java.rmi.RemoteException
        returns the distinct set of bins for this InvBalance's siteid. This is used for bin lookup lists.
        Throws:
        MXException
        java.rmi.RemoteException
      • canAddConditionCode

        protected boolean canAddConditionCode()
                                       throws MXException,
                                              java.rmi.RemoteException
        Can we allow condition code for the new InvBalances object?
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • setExpirationDateForThisLot

        protected void setExpirationDateForThisLot()
                                            throws MXException,
                                                   java.rmi.RemoteException
        Update the expiration date for all inventory balances having the same lot as the current Mbo. Update the inventory attributes "Available Quantity" and "Expired Quantity" as needed based on the new expiration date.
        Throws:
        MXException
        java.rmi.RemoteException
      • setShelfLifeForThisLot

        protected void setShelfLifeForThisLot()
                                       throws MXException,
                                              java.rmi.RemoteException
        Update the shelf life for all inventory balances having the same lot as the current Mbo.
        Throws:
        MXException
        java.rmi.RemoteException
      • adjustLifoFifoCurrentBalance

        public void adjustLifoFifoCurrentBalance(double newBalance)
                                          throws MXException,
                                                 java.rmi.RemoteException
        Adjusts the current balance for Lifo/Fifo items.
        Parameters:
        newBalance - The new balance
        Throws:
        MXException
        java.rmi.RemoteException
      • createInvTrans

        public MboRemote createInvTrans(double quantity,
                                        double unitcost,
                                        boolean isreconcile)
                                 throws MXException,
                                        java.rmi.RemoteException
        This method creates invtrans record for the current balance adjustment for Lifo/Fifo items fr consumption.
        Parameters:
        quantity -
        unitcost -
        Throws:
        MXException
        java.rmi.RemoteException
      • getNewBalanceForReconcile

        public double getNewBalanceForReconcile()
                                         throws MXException,
                                                java.rmi.RemoteException
        This method calculates the the new current balance for the invbalance record. It calculates by subtracting the issues and transfer out from storeroom and adding transfer in and returns to the storeroom to the physical count balance.
        Returns:
        new balance (current balance after reconcile)
        Throws:
        MXException
        java.rmi.RemoteException
      • reconcileBalancesLifoFifo

        public void reconcileBalancesLifoFifo(java.lang.String controlacc,
                                              java.lang.String shrinkageacc,
                                              java.lang.String remark)
                                       throws MXException,
                                              java.rmi.RemoteException
        Method to reconcile balance adjustments for the inventory of LIFO/FIFO cost type.
        Throws:
        MXException
        java.rmi.RemoteException
      • updateLifoFifoQtyAndCreateInvTrans

        public void updateLifoFifoQtyAndCreateInvTrans(boolean isreconcile)
                                                throws MXException,
                                                       java.rmi.RemoteException
        This method checks if the item is Condition enabled. It calls method to create map of InvBalance records and updates the quantity in invlifofifoCost table.
        Throws:
        MXException
        java.rmi.RemoteException
      • updateLifoFifoQtyAndCreateInvTrans

        public void updateLifoFifoQtyAndCreateInvTrans(java.util.HashMap condBalMap,
                                                       boolean isreconcile)
                                                throws MXException,
                                                       java.rmi.RemoteException
        This method call updateLifoFifoQuantity () for each entry in the Hash map.
        Parameters:
        HashMap -
        Throws:
        MXException
        java.rmi.RemoteException
      • updateLifoFifoQtyAndCreateInvTrans

        public void updateLifoFifoQtyAndCreateInvTrans(java.util.Vector invBalanceVec,
                                                       java.lang.String conditionCode,
                                                       boolean isreconcile)
                                                throws MXException,
                                                       java.rmi.RemoteException
        This method update invlifofifocost table and adjustcurrent balance for Lifo/Fifo items.
        Parameters:
        HashMap -
        Throws:
        MXException
        java.rmi.RemoteException
      • reconcileLifoFifoCurrentBalance

        public void reconcileLifoFifoCurrentBalance(double physcnt)
                                             throws MXException,
                                                    java.rmi.RemoteException
        This method updates the curbal and reconciled flag. This method will be called after adding the inventory transaction.
        Parameters:
        physcnt -
        Throws:
        MXException
        java.rmi.RemoteException
      • checkWMATStatus

        public boolean checkWMATStatus()
                                throws MXException
        Check to see if record exists in WOMATSTATUSSYNC table.
        Returns:
        record exists
        Throws:
        MXException
      • previewReconcileBalances

        public MboRemote previewReconcileBalances()
                                           throws MXException,
                                                  java.rmi.RemoteException
        This method is used to set value for non persistent attribute
        Returns:
        MboRemote
        Throws:
        MXException
        java.rmi.RemoteException