Class MDDOrder

All Implemented Interfaces:
Serializable, Cloneable, Comparator<Object>, I_Persistent, DocAction, Evaluatee, I_DD_Order

public class MDDOrder extends X_DD_Order implements DocAction
Order Distribution Model. Please do not set DocStatus and C_DocType_ID directly. They are set in the process() method. Use DocAction and C_DocTypeTarget_ID instead.
Author:
victor.perez@e-evolution.com, e-Evolution http://www.e-evolution.com
  • Original contributor of Distribution Functionality
  • FR [ 2520591 ] Support multiples calendar for Org
  • See Also:
    • Constructor Details

      • MDDOrder

        public MDDOrder(Properties ctx, String DD_Order_UU, String trxName)
        UUID based Constructor
        Parameters:
        ctx - Context
        DD_Order_UU - UUID key
        trxName - Transaction
      • MDDOrder

        public MDDOrder(Properties ctx, int DD_Order_ID, String trxName)
        Default Constructor
        Parameters:
        ctx - context
        DD_Order_ID - order to load, (0 create new order)
        trxName - trx name
      • MDDOrder

        public MDDOrder(MProject project, boolean IsSOTrx, String DocSubTypeSO)
        Project Constructor
        Parameters:
        project - Project to create Order from
        IsSOTrx - sales order
        DocSubTypeSO - if SO DocType Target (default DocSubTypeSO_OnCredit)
      • MDDOrder

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

        public MDDOrder(Properties ctx, int DD_Order_ID, String trxName, String... virtualColumns)
    • Method Details

      • copyFrom

        public static MDDOrder copyFrom(MDDOrder from, Timestamp dateDoc, int C_DocTypeTarget_ID, boolean isSOTrx, boolean counter, boolean copyASI, String trxName)
        Create new Order by copying
        Parameters:
        from - order
        dateDoc - date of the document date
        C_DocTypeTarget_ID - target document type
        isSOTrx - sales order
        counter - create counter links
        copyASI - copy line attributes Attribute Set Instance, Resaouce Assignment
        trxName - trx
        Returns:
        Distribution Order
      • addDescription

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

        public void setShip_BPartner_ID(int C_BPartner_ID)
        Set Ship Business Partner
        Parameters:
        C_BPartner_ID - bpartner
      • setShip_Location_ID

        public void setShip_Location_ID(int C_BPartner_Location_ID)
        Set Ship Business Partner Location
        Parameters:
        C_BPartner_Location_ID - bp location
      • setShip_User_ID

        public void setShip_User_ID(int AD_User_ID)
        Set Ship Business Partner Contact
        Parameters:
        AD_User_ID - user
      • setBPartner

        public void setBPartner(MBPartner bp)
        Set Business Partner Defaults and Details. SOTrx should be set.
        Parameters:
        bp - business partner
      • copyLinesFrom

        public int copyLinesFrom(MDDOrder otherOrder, boolean counter, boolean copyASI)
        Copy Lines From other Order
        Parameters:
        otherOrder - order
        counter - set counter info
        copyASI - copy line attributes Attribute Set Instance, Resource Assignment
        Returns:
        number of lines copied
      • toString

        public String toString()
        String Representation
        Overrides:
        toString in class X_DD_Order
        Returns:
        info
      • 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 MDDOrderLine[] getLines(String whereClause, String orderClause)
        Get Lines of Order
        Parameters:
        whereClause - where clause or null (starting with AND)
        orderClause - order clause
        Returns:
        lines
      • getLines

        public MDDOrderLine[] getLines(boolean requery, String orderBy)
        Get Lines of Order
        Parameters:
        requery - requery
        orderBy - optional order by column
        Returns:
        lines
      • getLines

        public MDDOrderLine[] getLines()
        Get Lines of Order. (useb by web store)
        Returns:
        lines
      • renumberLines

        public void renumberLines(int step)
        Renumber Lines
        Parameters:
        step - start and step
      • getMovement

        public MMovement[] getMovement()
        Get Shipments of Order
        Returns:
        shipments
      • getDocStatusName

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

        public void setDocAction(String DocAction)
        Set DocAction
        Specified by:
        setDocAction in interface I_DD_Order
        Overrides:
        setDocAction in class X_DD_Order
        Parameters:
        DocAction - doc action
      • setProcessed

        public void setProcessed(boolean processed)
        Set Processed. Propergate to Lines/Taxes
        Specified by:
        setProcessed in interface I_DD_Order
        Overrides:
        setProcessed in class X_DD_Order
        Parameters:
        processed - processed
      • beforeSave

        protected boolean beforeSave(boolean newRecord)
        Description copied from class: PO
        Called before Save for Pre-Save Operation.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        beforeSave in class PO
        Parameters:
        newRecord - true if it is a new record
        Returns:
        true if record can be saved
      • afterSave

        protected boolean afterSave(boolean newRecord, boolean success)
        Description copied from class: PO
        Called after Save for Post-Save Operation.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        afterSave in class PO
        Parameters:
        newRecord - true if it is a new record
        success - true if save operation was success
        Returns:
        if save was a success
      • setDocAction

        public void setDocAction(String DocAction, boolean forceCreation)
        Set DocAction
        Parameters:
        DocAction - doc oction
        forceCreation - force creation
      • beforeDelete

        protected boolean beforeDelete()
        Description copied from class: PO
        Execute before Delete operations.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        beforeDelete in class PO
        Returns:
        true if record can be deleted
      • 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)
      • reserveStock

        public void reserveStock(MDDOrderLine[] lines)
        Reserve Inventory. Counterpart: MMovement.completeIt()
        Parameters:
        lines - distribution order lines (ordered by M_Product_ID for deadlock prevention)
      • 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 ..)
      • voidIt

        public boolean voidIt()
        Void Document. Set Qtys to 0 - Sales: reverse all documents
        Specified by:
        voidIt in interface DocAction
        Returns:
        true if success
      • closeIt

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

        public boolean reverseCorrectIt()
        Reverse Correction - same void
        Specified by:
        reverseCorrectIt in interface DocAction
        Returns:
        true if success
      • 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:
        true if success
      • 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
      • getApprovalAmt

        public BigDecimal getApprovalAmt()
        Description copied from interface: DocAction
        Get Document Approval Amount
        Specified by:
        getApprovalAmt in interface DocAction
        Returns:
        amount
      • getC_Currency_ID

        public int getC_Currency_ID()
        Description copied from interface: DocAction
        Get Document Currency
        Specified by:
        getC_Currency_ID in interface DocAction
        Returns:
        C_Currency_ID
      • isComplete

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