Class MProduction

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

public class MProduction extends X_M_Production implements DocAction
See Also:
  • Field Details

    • m_log

      protected static CLogger m_log
      Log
    • lineno

      protected int lineno
    • count

      protected int count
    • m_processMsg

      protected String m_processMsg
      Process Message
    • m_justPrepared

      protected boolean m_justPrepared
      Just Prepared Flag
  • Constructor Details

    • MProduction

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

      public MProduction(Properties ctx, int M_Production_ID, String trxName)
      Parameters:
      ctx -
      M_Production_ID -
      trxName -
    • MProduction

      public MProduction(Properties ctx, int M_Production_ID, String trxName, String... virtualColumns)
      Parameters:
      ctx -
      M_Production_ID -
      trxName -
      virtualColumns -
    • MProduction

      public MProduction(Properties ctx, ResultSet rs, String trxName)
      Parameters:
      ctx -
      rs -
      trxName -
    • MProduction

      public MProduction(MOrderLine line)
      Create new production with client, organization and date promised (as movement date) from order line.
      Parameters:
      line - order line
    • MProduction

      public MProduction(MProjectLine line)
      Create new production for project line
      Parameters:
      line - project line
  • Method Details

    • completeIt

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

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

      protected Object processLines(MProductionLine[] lines)
      Process production lines - create material transaction
      Parameters:
      lines -
      Returns:
      error message or empty string
    • getLines

      public MProductionLine[] getLines()
      Get production lines
      Returns:
      array of MProductionLine
    • deleteLines

      public void deleteLines(String trxName)
      Delete all production lines
      Parameters:
      trxName -
    • createLines

      public int createLines(boolean mustBeStocked)
      Create production lines
      Parameters:
      mustBeStocked - true to verify BOM component has sufficient on hand
      Returns:
      number of line created
    • createLines

      public int createLines(boolean mustBeStocked, int PP_Product_BOM_ID)
      Create production line
      Parameters:
      mustBeStocked - true to verify BOM component has sufficient on hand
      PP_Product_BOM_ID - optional BOM ID. 0 to use default product BOM
      Returns:
      number of line created
    • createLines

      protected int createLines(boolean mustBeStocked, MProduct finishedProduct, BigDecimal requiredQty, int PP_Product_BOM_ID)
      Create production line
      Parameters:
      mustBeStocked - true to verify BOM component has sufficient on hand
      finishedProduct - end product
      requiredQty -
      PP_Product_BOM_ID - optional BOM ID. 0 to use default product BOM
      Returns:
      number of line created
    • 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)
      Description copied from interface: DocAction
      Process document with document action
      Specified by:
      processIt in interface DocAction
      Parameters:
      processAction - document action
      Returns:
      true if performed
    • unlockIt

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

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

      public String prepareIt()
      Description copied from interface: DocAction
      Prepare Document for a document action
      Specified by:
      prepareIt in interface DocAction
      Returns:
      new status (In Progress or Invalid)
    • validateEndProduct

      public String validateEndProduct(int M_Product_ID)
      Parameters:
      M_Product_ID -
      Returns:
      error message (if any) or null
    • isBom

      protected String isBom(int M_Product_ID)
      Validate product has valid BOM
      Parameters:
      M_Product_ID -
      Returns:
      error message or null
    • costsOK

      protected boolean costsOK(int M_Product_ID) throws AdempiereUserError
      Cost validation for BOM product using standard costing method.
      - has cost
      - difference between current product cost and sum of component cost is less than 0.005.
      Parameters:
      M_Product_ID -
      Returns:
      true if cost is ok
      Throws:
      AdempiereUserError
    • approveIt

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

      public boolean rejectIt()
      Description copied from interface: DocAction
      Reject Approval
      Specified by:
      rejectIt in interface DocAction
      Returns:
      true if success
    • voidIt

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

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

      public boolean reverseCorrectIt()
      Description copied from interface: DocAction
      Reverse Correction
      Specified by:
      reverseCorrectIt in interface DocAction
      Returns:
      true if success
    • reverse

      protected MProduction reverse(boolean accrual)
      Reverse this production document
      Parameters:
      accrual - true to use current date, false to use this production's movement date
      Returns:
      reversal production record
    • copyFrom

      protected MProduction copyFrom(Timestamp reversalDate)
      Create new production from this production (including lines)
      Parameters:
      reversalDate - movement date
      Returns:
      new production record
    • addDescription

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

      public boolean reverseAccrualIt()
      Description copied from interface: DocAction
      Reverse Accrual
      Specified by:
      reverseAccrualIt in interface DocAction
      Returns:
      true if success
    • reActivateIt

      public boolean reActivateIt()
      Description copied from interface: DocAction
      Re-activate (typically from Complete to In Progress)
      Specified by:
      reActivateIt in interface DocAction
      Returns:
      true if success
    • getSummary

      public String getSummary()
      Description copied from interface: DocAction
      Get Summary
      Specified by:
      getSummary in interface DocAction
      Returns:
      Summary of Document
    • getDocumentInfo

      public String getDocumentInfo()
      Description copied from interface: DocAction
      Get Document Info
      Specified by:
      getDocumentInfo in interface DocAction
      Returns:
      Type and Document No
    • createPDF

      public File createPDF()
      Description copied from interface: DocAction
      Create PDF
      Specified by:
      createPDF in interface DocAction
      Returns:
      file
    • getProcessMsg

      public String getProcessMsg()
      Description copied from interface: DocAction
      Get Process Message from last execution of a document action
      Specified by:
      getProcessMsg in interface DocAction
      Returns:
      clear text message
    • getDoc_User_ID

      public int getDoc_User_ID()
      Description copied from interface: DocAction
      Get Document Owner
      Specified by:
      getDoc_User_ID in interface DocAction
      Returns:
      AD_User_ID
    • 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
    • getApprovalAmt

      public BigDecimal getApprovalAmt()
      Description copied from interface: DocAction
      Get Document Approval Amount
      Specified by:
      getApprovalAmt in interface DocAction
      Returns:
      amount
    • 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
    • isStatusComplete

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