Class MInOut

  • All Implemented Interfaces:
    Serializable, Cloneable, Comparator<Object>, I_M_InOut, I_Persistent, DocAction, IDocsPostProcess, Evaluatee

    public class MInOut
    extends X_M_InOut
    implements DocAction, IDocsPostProcess
    Shipment Model
    Version:
    $Id: MInOut.java,v 1.4 2006/07/30 00:51:03 jjanke Exp $ Modifications: Added the RMA functionality (Ashley Ramdass)
    Author:
    Jorg Janke, Karsten Thiemann, Schaeffer AG
  • Bug [ 1759431 ] Problems with VCreateFrom, victor.perez@e-evolution.com, e-Evolution http://www.e-evolution.com
  • FR [ 1948157 ] Is necessary the reference for document reverse
  • FR [ 2520591 ] Support multiples calendar for Org, Armen Rizal, Goodwill Consulting
  • BF [ 1745154 ] Cost in Reversing Material Related Docs, Teo Sarca, teo.sarca@gmail.com
  • BF [ 2993853 ] Voiding/Reversing Receipt should void confirmations https://sourceforge.net/p/adempiere/bugs/2395/
  • See Also:
    Serialized Form
    • Field Detail

      • m_partner

        protected MBPartner m_partner
        BPartner
      • m_reversal

        protected boolean m_reversal
        Reversal Flag
      • m_processMsg

        protected String m_processMsg
        Process Message
      • m_justPrepared

        protected boolean m_justPrepared
        Just Prepared Flag
    • Constructor Detail

      • MInOut

        public MInOut​(Properties ctx,
                      int M_InOut_ID,
                      String trxName)
        Standard Constructor
        Parameters:
        ctx - context
        M_InOut_ID -
        trxName - rx name
      • MInOut

        public MInOut​(Properties ctx,
                      ResultSet rs,
                      String trxName)
        Load Constructor
        Parameters:
        ctx - context
        rs - result set record
        trxName - transaction
      • MInOut

        public MInOut​(MOrder order,
                      int C_DocTypeShipment_ID,
                      Timestamp movementDate)
        Order Constructor - create header only
        Parameters:
        order - order
        movementDate - optional movement date (default today)
        C_DocTypeShipment_ID - document type or 0
      • MInOut

        public MInOut​(MInvoice invoice,
                      int C_DocTypeShipment_ID,
                      Timestamp movementDate,
                      int M_Warehouse_ID)
        Invoice Constructor - create header only
        Parameters:
        invoice - invoice
        C_DocTypeShipment_ID - document type or 0
        movementDate - optional movement date (default today)
        M_Warehouse_ID - warehouse
      • MInOut

        public MInOut​(MInOut original,
                      int C_DocTypeShipment_ID,
                      Timestamp movementDate)
        Copy Constructor - create header only
        Parameters:
        original - original
        movementDate - optional movement date (default today)
        C_DocTypeShipment_ID - document type or 0
    • Method Detail

      • createFrom

        public static MInOut createFrom​(MOrder order,
                                        Timestamp movementDate,
                                        boolean forceDelivery,
                                        boolean allAttributeInstances,
                                        Timestamp minGuaranteeDate,
                                        boolean complete,
                                        String trxName)
        Create Shipment From Order
        Parameters:
        order - order
        movementDate - optional movement date
        forceDelivery - ignore order delivery rule
        allAttributeInstances - if true, all attribute set instances
        minGuaranteeDate - optional minimum guarantee date if all attribute instances
        complete - complete document (Process if false, Complete if true)
        trxName - transaction
        Returns:
        Shipment or null
      • copyFrom

        public static MInOut copyFrom​(MInOut from,
                                      Timestamp dateDoc,
                                      Timestamp dateAcct,
                                      int C_DocType_ID,
                                      boolean isSOTrx,
                                      boolean counter,
                                      String trxName,
                                      boolean setOrder)
        Create new Shipment by copying
        Parameters:
        from - shipment
        dateDoc - date of the document date
        C_DocType_ID - doc type
        isSOTrx - sales order
        counter - create counter links
        trxName - trx
        setOrder - set the order link
        Returns:
        Shipment
      • copyFrom

        public static MInOut copyFrom​(MInOut from,
                                      Timestamp dateDoc,
                                      int C_DocType_ID,
                                      boolean isSOTrx,
                                      boolean counter,
                                      String trxName,
                                      boolean setOrder)
        Deprecated.
        Create new Shipment by copying
        Parameters:
        from - shipment
        dateDoc - date of the document date
        C_DocType_ID - doc type
        isSOTrx - sales order
        counter - create counter links
        trxName - trx
        setOrder - set the order link
        Returns:
        Shipment
      • getDocStatusName

        public String getDocStatusName()
        Get Document Status
        Returns:
        Document Status Clear Text
      • addDescription

        public void addDescription​(String description)
        Add to Description
        Parameters:
        description - text
      • getDocumentInfo

        public String getDocumentInfo()
        Get Document Info
        Specified by:
        getDocumentInfo in interface DocAction
        Returns:
        document info (untranslated)
      • createPDF

        public File createPDF()
        Create PDF
        Specified by:
        createPDF in interface DocAction
        Returns:
        File or null
      • createPDF

        public File createPDF​(File file)
        Create PDF file
        Parameters:
        file - output file
        Returns:
        file if success
      • getLines

        public MInOutLine[] getLines​(boolean requery)
        Get Lines of Shipment
        Parameters:
        requery - refresh from db
        Returns:
        lines
      • getLines

        public MInOutLine[] getLines()
        Get Lines of Shipment
        Returns:
        lines
      • getConfirmations

        public MInOutConfirm[] getConfirmations​(boolean requery)
        Get Confirmations
        Parameters:
        requery - requery
        Returns:
        array of Confirmations
      • copyLinesFrom

        public int copyLinesFrom​(MInOut otherShipment,
                                 boolean counter,
                                 boolean setOrder)
        Copy Lines From other Shipment
        Parameters:
        otherShipment - shipment
        counter - set counter info
        setOrder - set order link
        Returns:
        number of lines copied
      • setReversal

        protected void setReversal​(boolean reversal)
        Set Reversal
        Parameters:
        reversal - reversal
      • isReversal

        public boolean isReversal()
        Is Reversal
        Returns:
        reversal
      • setProcessed

        public void setProcessed​(boolean processed)
        Set Processed. Propagate to Lines/Taxes
        Specified by:
        setProcessed in interface I_M_InOut
        Overrides:
        setProcessed in class X_M_InOut
        Parameters:
        processed - processed
      • getBPartner

        public MBPartner getBPartner()
        Get BPartner
        Returns:
        partner
      • setC_DocType_ID

        public void setC_DocType_ID​(String DocBaseType)
        Set Document Type
        Parameters:
        DocBaseType - doc type MDocType.DOCBASETYPE_
      • setC_DocType_ID

        public void setC_DocType_ID()
        Set Default C_DocType_ID. Based on SO flag
      • setBPartner

        public void setBPartner​(MBPartner bp)
        Set Business Partner Defaults and Details
        Parameters:
        bp - business partner
      • createConfirmation

        public void createConfirmation()
        Create the missing next Confirmation
      • voidConfirmations

        protected void voidConfirmations()
      • getMovementType

        public static String getMovementType​(Properties ctx,
                                             int C_DocType_ID,
                                             boolean issotrx,
                                             String trxName)
        Gets Movement Type based on Document Type's DocBaseType and isSOTrx
        Parameters:
        ctx -
        C_DocType_ID - Document Type ID
        issotrx - is sales transaction
        trxName - transaction name
        Returns:
        Movement Type
      • setMovementType

        public void setMovementType()
        Sets Movement Type based on Document Type's DocBaseType and isSOTrx
      • beforeSave

        protected boolean beforeSave​(boolean newRecord)
        Before Save
        Overrides:
        beforeSave in class PO
        Parameters:
        newRecord - new
        Returns:
        true or false
      • afterSave

        protected boolean afterSave​(boolean newRecord,
                                    boolean success)
        After Save
        Overrides:
        afterSave in class PO
        Parameters:
        newRecord - new
        success - success
        Returns:
        success
      • processIt

        public boolean processIt​(String processAction)
        Process document
        Specified by:
        processIt in interface DocAction
        Parameters:
        processAction - document action
        Returns:
        true if performed
      • unlockIt

        public boolean unlockIt()
        Unlock Document.
        Specified by:
        unlockIt in interface DocAction
        Returns:
        true if success
      • invalidateIt

        public boolean invalidateIt()
        Invalidate Document
        Specified by:
        invalidateIt in interface DocAction
        Returns:
        true if success
      • prepareIt

        public String prepareIt()
        Prepare Document
        Specified by:
        prepareIt in interface DocAction
        Returns:
        new status (In Progress or Invalid)
      • approveIt

        public boolean approveIt()
        Approve Document
        Specified by:
        approveIt in interface DocAction
        Returns:
        true if success
      • rejectIt

        public boolean rejectIt()
        Reject Approval
        Specified by:
        rejectIt in interface DocAction
        Returns:
        true if success
      • completeIt

        public String completeIt()
        Complete Document
        Specified by:
        completeIt in interface DocAction
        Returns:
        new status (Complete, In Progress, Invalid, Waiting ..)
      • pendingCustomerConfirmations

        public boolean pendingCustomerConfirmations()
        Outstanding (not processed) Customer Confirmations ?
        Returns:
        true if there are pending Customer Confirmations
      • pendingConfirmations

        public boolean pendingConfirmations()
        Outstanding (not processed) Confirmations ?
        Returns:
        true if there are pending Confirmations
      • addDocsPostProcess

        protected void addDocsPostProcess​(PO doc)
      • createDropShipment

        protected MInOut createDropShipment()
        Automatically creates a customer shipment for any drop shipment material receipt Based on createCounterDoc() by JJ
        Returns:
        shipment if created else null
      • setDefiniteDocumentNo

        protected void setDefiniteDocumentNo()
        Set the definite document number after completed
      • checkMaterialPolicy

        protected void checkMaterialPolicy​(MInOutLine line,
                                           BigDecimal qty)
        Check Material Policy Sets line ASI
      • createCounterDoc

        protected MInOut createCounterDoc()
        Create Counter Document
        Returns:
        InOut
      • voidIt

        public boolean voidIt()
        Void Document.
        Specified by:
        voidIt in interface DocAction
        Returns:
        true if success
      • closeIt

        public boolean closeIt()
        Close Document.
        Specified by:
        closeIt in interface DocAction
        Returns:
        true if success
      • reverseCorrectIt

        public boolean reverseCorrectIt()
        Reverse Correction - same date
        Specified by:
        reverseCorrectIt in interface DocAction
        Returns:
        true if success
      • reverse

        protected MInOut reverse​(boolean accrual)
      • reverseMatching

        protected boolean reverseMatching​(Timestamp reversalDate)
      • reverseAccrualIt

        public boolean reverseAccrualIt()
        Reverse Accrual - none
        Specified by:
        reverseAccrualIt in interface DocAction
        Returns:
        false
      • reActivateIt

        public boolean reActivateIt()
        Re-activate
        Specified by:
        reActivateIt in interface DocAction
        Returns:
        false
      • getSummary

        public String getSummary()
        Get Summary
        Specified by:
        getSummary in interface DocAction
        Returns:
        Summary of Document
      • getProcessMsg

        public String getProcessMsg()
        Get Process Message
        Specified by:
        getProcessMsg in interface DocAction
        Returns:
        clear text error message
      • getDoc_User_ID

        public int getDoc_User_ID()
        Get Document Owner (Responsible)
        Specified by:
        getDoc_User_ID in interface DocAction
        Returns:
        AD_User_ID
      • getC_Currency_ID

        public int getC_Currency_ID()
        Get C_Currency_ID
        Specified by:
        getC_Currency_ID in interface DocAction
        Returns:
        Accounting Currency
      • isComplete

        public boolean isComplete()
        Document Status is Complete or Closed
        Returns:
        true if CO, CL or RE
      • moveOnHandToShipmentASI

        protected String moveOnHandToShipmentASI​(MProduct product,
                                                 int M_Locator_ID,
                                                 int M_AttributeSetInstance_ID,
                                                 BigDecimal qty,
                                                 Timestamp dateMaterialPolicy,
                                                 int M_InOutLine_ID,
                                                 boolean reversal,
                                                 String trxName)
        For product with mix of No ASI and ASI inventory, this move Non ASI on hand to the new ASI created at shipment line or shipment line ma
        Parameters:
        product -
        M_Locator_ID - shipment line locator id
        M_AttributeSetInstance_ID -
        qty -
        dateMaterialPolicy -
        M_InOutLine_ID -
        reversal -
        trxName -
        Returns:
        error doc status if there are any errors