Package org.compiere.model

Examples of org.compiere.model.MInventoryLine


  private void addPackedProductLine(X_Z_Packs  pack,
                                    MProduct   packedProduct,
                                    MInventory inv,
                                    int        chargeID)
  {
    MInventoryLine invLine = new MInventoryLine(inv,
                                                p_M_Locator_ID,
                                                packedProduct.getM_Product_ID(),
                                                pack.getM_AttributeSetInstance_ID(),
                                                BigDecimal.ZERO,
                                                BigDecimal.ZERO);
    // Packed product line calculation = -Qty
    invLine.setQtyInternalUse(pack.getQty().multiply(BigDecimal.valueOf(-1)));
    invLine.setDescription("Packed Product");
    invLine.setC_Charge_ID(chargeID);
    invLine.setAD_Org_ID(Env.getAD_Org_ID(getCtx()));
    invLine.setM_Inventory_ID(inv.getM_Inventory_ID());
    invLine.save(get_TrxName());
   
  } //  addPackedProductLine
View Full Code Here


                            MProduct      packedProduct,
                            MInventory    inv,
                            int           chargeID) throws Exception
  {
    MPPProductBOMLine[] bomLines = bom.getLines();
    MInventoryLine invLine;
    MProduct lineProduct;
    MAttributeSetInstance asi = new MAttributeSetInstance(getCtx(),
                                                          pack.getM_AttributeSetInstance_ID(),
                                                          get_TrxName());
    BigDecimal sg = (BigDecimal)asi.get_Value("SG");
    BigDecimal vol;
    int asiID;
   
    // Make sure SG in the Attribute Set Instance has a value.  Abort if not.
    if (sg == null || sg.equals(BigDecimal.valueOf(0)))
      throw new AdempiereUserError("@Error@ SG value not set for Attribute Set Instance "+
                                   asi.getDescription());
   
    // Generate inventory lines from the BOM lines
    for (MPPProductBOMLine bomLine : bomLines)
    {
      lineProduct = new MProduct(getCtx(), bomLine.getM_Product_ID(), get_TrxName());
     
      // Only assign the Attribute Set Instance to lines where the product on
      // that line has a Finished Product Batch Number
      if (lineProduct.getAttributeSet() != null &&
          lineProduct.getAttributeSet().getName().equals("Finished Product Batch Number"))
        asiID = asi.getM_AttributeSetInstance_ID();
      else
        asiID = 0;
     
      invLine = new MInventoryLine(inv,
                                   p_M_Locator_ID,
                                   lineProduct.getM_Product_ID(),
                                   asiID,
                                   BigDecimal.ZERO,
                                   BigDecimal.ZERO);
     
      // Bulk line calculation = Qty x SG x Vol.  Other lines = Qty x QtyBOM.
      if ((Boolean)lineProduct.get_Value("IsBulk"))
      {
        vol = packedProduct.getVolume();
        invLine.setQtyInternalUse(pack.getQty().multiply(sg).multiply(vol));
      }
      else
      {
        invLine.setQtyInternalUse(pack.getQty().multiply(bomLine.getQtyBOM()));
      }
     
      invLine.setDescription("Pack");
      invLine.setC_Charge_ID(chargeID);
      invLine.setAD_Org_ID(Env.getAD_Org_ID(getCtx()));
      invLine.setM_Inventory_ID(inv.getM_Inventory_ID());
      invLine.save(get_TrxName());
       
    } // end for
   
  } //  copyBOMLines
View Full Code Here

TOP

Related Classes of org.compiere.model.MInventoryLine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.