Class PackingSession

java.lang.Object
org.apache.ofbiz.shipment.packing.PackingSession
All Implemented Interfaces:
Serializable

public class PackingSession extends Object implements Serializable
See Also:
  • Constructor Details

    • PackingSession

      public PackingSession(LocalDispatcher dispatcher, GenericValue userLogin, String facilityId, String binId, String orderId, String shipGrp)
      Instantiates a new Packing session.
      Parameters:
      dispatcher - the dispatcher
      userLogin - the user login
      facilityId - the facility id
      binId - the bin id
      orderId - the order id
      shipGrp - the ship grp
    • PackingSession

      public PackingSession(LocalDispatcher dispatcher, GenericValue userLogin, String facilityId)
      Instantiates a new Packing session.
      Parameters:
      dispatcher - the dispatcher
      userLogin - the user login
      facilityId - the facility id
    • PackingSession

      public PackingSession(LocalDispatcher dispatcher, GenericValue userLogin)
      Instantiates a new Packing session.
      Parameters:
      dispatcher - the dispatcher
      userLogin - the user login
  • Method Details

    • addOrIncreaseLine

      public void addOrIncreaseLine(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, BigDecimal quantity, int packageSeqId, BigDecimal weight, boolean update) throws GeneralException
      Add or increase line.
      Parameters:
      orderId - the order id
      orderItemSeqId - the order item seq id
      shipGroupSeqId - the ship group seq id
      productId - the product id
      quantity - the quantity
      packageSeqId - the package seq id
      weight - the weight
      update - the update
      Throws:
      GeneralException - the general exception
    • addOrIncreaseLine

      public void addOrIncreaseLine(String orderId, String orderItemSeqId, String shipGroupSeqId, BigDecimal quantity, int packageSeqId) throws GeneralException
      Add or increase line.
      Parameters:
      orderId - the order id
      orderItemSeqId - the order item seq id
      shipGroupSeqId - the ship group seq id
      quantity - the quantity
      packageSeqId - the package seq id
      Throws:
      GeneralException - the general exception
    • addOrIncreaseLine

      public void addOrIncreaseLine(String productId, BigDecimal quantity, int packageSeqId) throws GeneralException
      Add or increase line.
      Parameters:
      productId - the product id
      quantity - the quantity
      packageSeqId - the package seq id
      Throws:
      GeneralException - the general exception
    • findLine

      public PackingSessionLine findLine(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, String inventoryItemId, int packageSeq)
      Find line packing session line.
      Parameters:
      orderId - the order id
      orderItemSeqId - the order item seq id
      shipGroupSeqId - the ship group seq id
      productId - the product id
      inventoryItemId - the inventory item id
      packageSeq - the package seq
      Returns:
      the packing session line
    • createPackLineItem

      protected void createPackLineItem(int checkCode, GenericValue res, String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, BigDecimal quantity, BigDecimal weight, int packageSeqId) throws GeneralException
      Create pack line item.
      Parameters:
      checkCode - the check code
      res - the res
      orderId - the order id
      orderItemSeqId - the order item seq id
      shipGroupSeqId - the ship group seq id
      productId - the product id
      quantity - the quantity
      weight - the weight
      packageSeqId - the package seq id
      Throws:
      GeneralException - the general exception
    • findOrderItemSeqId

      protected List<String> findOrderItemSeqId(String productId, String orderId, String shipGroupSeqId, BigDecimal quantity) throws GeneralException
      Find order item seq id string.
      Parameters:
      productId - the product id
      orderId - the order id
      shipGroupSeqId - the ship group seq id
      quantity - the quantity
      Returns:
      the string
      Throws:
      GeneralException - the general exception
    • checkLineForAdd

      protected int checkLineForAdd(GenericValue res, String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, BigDecimal quantity, int packageSeqId, boolean update)
      Check line for add int.
      Parameters:
      res - the res
      orderId - the order id
      orderItemSeqId - the order item seq id
      shipGroupSeqId - the ship group seq id
      productId - the product id
      quantity - the quantity
      packageSeqId - the package seq id
      update - the update
      Returns:
      the int
    • addItemInfo

      public void addItemInfo(List<GenericValue> infos)
      Add item info.
      Parameters:
      infos - the infos
    • getItemInfos

      public List<org.apache.ofbiz.shipment.packing.PackingSession.ItemDisplay> getItemInfos()
      Gets item infos.
      Returns:
      the item infos
    • getPackingSessionLinesByPackage

      public Map<Object,Object> getPackingSessionLinesByPackage()

      Delivers all the packing lines grouped by package.

      Output map:
      • packageMap - a Map of type Map<Integer, List<PackingSessionLine>> that maps package sequence ids to the lines that belong in that package
      • sortedKeys - a List of type List<Integer> with the sorted package sequence numbers to index the packageMap
      Returns:
      result Map with packageMap and sortedKeys
    • clearItemInfos

      public void clearItemInfos()
      Clear item infos.
    • getShipmentId

      public String getShipmentId()
      Gets shipment id.
      Returns:
      the shipment id
    • getLines

      public List<PackingSessionLine> getLines()
      Gets lines.
      Returns:
      the lines
    • nextPackageSeq

      public int nextPackageSeq()
      Next package seq int.
      Returns:
      the int
    • getCurrentPackageSeq

      public int getCurrentPackageSeq()
      Gets current package seq.
      Returns:
      the current package seq
    • getPackedQuantity

      public BigDecimal getPackedQuantity(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId)
      Gets packed quantity.
      Parameters:
      orderId - the order id
      orderItemSeqId - the order item seq id
      shipGroupSeqId - the ship group seq id
      productId - the product id
      Returns:
      the packed quantity
    • getPackedQuantity

      public BigDecimal getPackedQuantity(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, int packageSeq)
      Gets packed quantity.
      Parameters:
      orderId - the order id
      orderItemSeqId - the order item seq id
      shipGroupSeqId - the ship group seq id
      productId - the product id
      packageSeq - the package seq
      Returns:
      the packed quantity
    • getPackedQuantity

      public BigDecimal getPackedQuantity(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, String inventoryItemId, int packageSeq)
      Gets packed quantity.
      Parameters:
      orderId - the order id
      orderItemSeqId - the order item seq id
      shipGroupSeqId - the ship group seq id
      productId - the product id
      inventoryItemId - the inventory item id
      packageSeq - the package seq
      Returns:
      the packed quantity
    • getPackedQuantity

      public BigDecimal getPackedQuantity(String productId, int packageSeq)
      Gets packed quantity.
      Parameters:
      productId - the product id
      packageSeq - the package seq
      Returns:
      the packed quantity
    • getPackedQuantity

      public BigDecimal getPackedQuantity(int packageSeq)
      Gets packed quantity.
      Parameters:
      packageSeq - the package seq
      Returns:
      the packed quantity
    • getPackedQuantity

      public BigDecimal getPackedQuantity(String productId)
      Gets packed quantity.
      Parameters:
      productId - the product id
      Returns:
      the packed quantity
    • getCurrentReservedQuantity

      public BigDecimal getCurrentReservedQuantity(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId)
      Gets current reserved quantity.
      Parameters:
      orderId - the order id
      orderItemSeqId - the order item seq id
      shipGroupSeqId - the ship group seq id
      productId - the product id
      Returns:
      the current reserved quantity
    • getCurrentShippedQuantity

      public BigDecimal getCurrentShippedQuantity(String orderId, String orderItemSeqId, String shipGroupSeqId)
      Gets current shipped quantity.
      Parameters:
      orderId - the order id
      orderItemSeqId - the order item seq id
      shipGroupSeqId - the ship group seq id
      Returns:
      the current shipped quantity
    • getCurrentShipmentIds

      public List<String> getCurrentShipmentIds(String orderId, String orderItemSeqId, String shipGroupSeqId)
      Gets current shipment ids.
      Parameters:
      orderId - the order id
      orderItemSeqId - the order item seq id
      shipGroupSeqId - the ship group seq id
      Returns:
      the current shipment ids
    • getCurrentShipmentIds

      public List<String> getCurrentShipmentIds(String orderId, String shipGroupSeqId)
      Gets current shipment ids.
      Parameters:
      orderId - the order id
      shipGroupSeqId - the ship group seq id
      Returns:
      the current shipment ids
    • registerEvent

      public void registerEvent(PackingEvent event)
      Register event.
      Parameters:
      event - the event
    • getDispatcher

      public LocalDispatcher getDispatcher()
      Gets dispatcher.
      Returns:
      the dispatcher
    • getDelegator

      public Delegator getDelegator()
      Gets delegator.
      Returns:
      the delegator
    • getUserLogin

      public GenericValue getUserLogin()
      Gets user login.
      Returns:
      the user login
    • getStatus

      public int getStatus()
      Gets status.
      Returns:
      the status
    • getFacilityId

      public String getFacilityId()
      Gets facility id.
      Returns:
      the facility id
    • setFacilityId

      public void setFacilityId(String facilityId)
      Sets facility id.
      Parameters:
      facilityId - the facility id
    • getPrimaryOrderId

      public String getPrimaryOrderId()
      Gets primary order id.
      Returns:
      the primary order id
    • setPrimaryOrderId

      public void setPrimaryOrderId(String orderId)
      Sets primary order id.
      Parameters:
      orderId - the order id
    • getPrimaryShipGroupSeqId

      public String getPrimaryShipGroupSeqId()
      Gets primary ship group seq id.
      Returns:
      the primary ship group seq id
    • setPrimaryShipGroupSeqId

      public void setPrimaryShipGroupSeqId(String shipGroupSeqId)
      Sets primary ship group seq id.
      Parameters:
      shipGroupSeqId - the ship group seq id
    • setPicklistBinId

      public void setPicklistBinId(String binId)
      Sets picklist bin id.
      Parameters:
      binId - the bin id
    • getPicklistBinId

      public String getPicklistBinId()
      Gets picklist bin id.
      Returns:
      the picklist bin id
    • getHandlingInstructions

      public String getHandlingInstructions()
      Gets handling instructions.
      Returns:
      the handling instructions
    • setHandlingInstructions

      public void setHandlingInstructions(String instructions)
      Sets handling instructions.
      Parameters:
      instructions - the instructions
    • setPickerPartyId

      public void setPickerPartyId(String partyId)
      Sets picker party id.
      Parameters:
      partyId - the party id
    • getPickerPartyId

      public String getPickerPartyId()
      Gets picker party id.
      Returns:
      the picker party id
    • clearLastPackage

      public int clearLastPackage()
      Clear last package int.
      Returns:
      the int
    • clearLine

      public void clearLine(PackingSessionLine line)
      Clear line.
      Parameters:
      line - the line
    • clearAllLines

      public void clearAllLines()
      Clear all lines.
    • clear

      public void clear()
      Clear.
    • complete

      public String complete(boolean force) throws GeneralException
      Complete string.
      Parameters:
      force - the force
      Returns:
      the string
      Throws:
      GeneralException - the general exception
    • checkReservations

      protected void checkReservations(boolean ignore) throws GeneralException
      Check reservations.
      Parameters:
      ignore - the ignore
      Throws:
      GeneralException - the general exception
    • checkEmptyLines

      protected void checkEmptyLines() throws GeneralException
      Check empty lines.
      Throws:
      GeneralException - the general exception
    • runEvents

      protected void runEvents(int eventCode)
      Run events.
      Parameters:
      eventCode - the event code
    • getItemIssuances

      protected List<GenericValue> getItemIssuances(String orderId, String orderItemSeqId, String shipGroupSeqId)
      Gets item issuances.
      Parameters:
      orderId - the order id
      orderItemSeqId - the order item seq id
      shipGroupSeqId - the ship group seq id
      Returns:
      the item issuances
    • createShipment

      protected void createShipment() throws GeneralException
      Create shipment.
      Throws:
      GeneralException - the general exception
    • issueItemsToShipment

      protected void issueItemsToShipment() throws GeneralException
      Issue items to shipment.
      Throws:
      GeneralException - the general exception
    • checkLine

      protected boolean checkLine(List<PackingSessionLine> processedLines, PackingSessionLine line)
      Check line boolean.
      Parameters:
      processedLines - the processed lines
      line - the line
      Returns:
      the boolean
    • createPackages

      protected void createPackages() throws GeneralException
      Create packages.
      Throws:
      GeneralException - the general exception
    • applyItemsToPackages

      protected void applyItemsToPackages() throws GeneralException
      Apply items to packages.
      Throws:
      GeneralException - the general exception
    • updateShipmentRouteSegments

      protected void updateShipmentRouteSegments() throws GeneralException
      Update shipment route segments.
      Throws:
      GeneralException - the general exception
    • setShipmentToPacked

      protected void setShipmentToPacked() throws GeneralException
      Sets shipment to packed.
      Throws:
      GeneralException - the general exception
    • setPicklistToPicked

      protected void setPicklistToPicked() throws GeneralException
      Sets picklist to picked.
      Throws:
      GeneralException - the general exception
    • setPickerOnPicklist

      protected void setPickerOnPicklist() throws GeneralException
      Sets picker on picklist.
      Throws:
      GeneralException - the general exception
    • getAdditionalShippingCharge

      public BigDecimal getAdditionalShippingCharge()
      Gets additional shipping charge.
      Returns:
      the additional shipping charge
    • setAdditionalShippingCharge

      public void setAdditionalShippingCharge(BigDecimal additionalShippingCharge)
      Sets additional shipping charge.
      Parameters:
      additionalShippingCharge - the additional shipping charge
    • getTotalWeight

      public BigDecimal getTotalWeight()
      Gets total weight.
      Returns:
      the total weight
    • getShipmentCostEstimate

      public BigDecimal getShipmentCostEstimate(GenericValue orderItemShipGroup, String productStoreId, List<GenericValue> shippableItemInfo, BigDecimal shippableTotal, BigDecimal shippableWeight, BigDecimal shippableQuantity)
      Gets shipment cost estimate.
      Parameters:
      orderItemShipGroup - the order item ship group
      productStoreId - the product store id
      shippableItemInfo - the shippable item info
      shippableTotal - the shippable total
      shippableWeight - the shippable weight
      shippableQuantity - the shippable quantity
      Returns:
      the shipment cost estimate
    • getShipmentCostEstimate

      public BigDecimal getShipmentCostEstimate(GenericValue orderItemShipGroup, String productStoreId)
      Gets shipment cost estimate.
      Parameters:
      orderItemShipGroup - the order item ship group
      productStoreId - the product store id
      Returns:
      the shipment cost estimate
    • getShipmentCostEstimate

      public BigDecimal getShipmentCostEstimate(String shippingContactMechId, String shipmentMethodTypeId, String carrierPartyId, String carrierRoleTypeId, String productStoreId, List<GenericValue> shippableItemInfo, BigDecimal shippableTotal, BigDecimal shippableWeight, BigDecimal shippableQuantity)
      Gets shipment cost estimate.
      Parameters:
      shippingContactMechId - the shipping contact mech id
      shipmentMethodTypeId - the shipment method type id
      carrierPartyId - the carrier party id
      carrierRoleTypeId - the carrier role type id
      productStoreId - the product store id
      shippableItemInfo - the shippable item info
      shippableTotal - the shippable total
      shippableWeight - the shippable weight
      shippableQuantity - the shippable quantity
      Returns:
      the shipment cost estimate
    • getWeightUomId

      public String getWeightUomId()
      Gets weight uom id.
      Returns:
      the weight uom id
    • setWeightUomId

      public void setWeightUomId(String weightUomId)
      Sets weight uom id.
      Parameters:
      weightUomId - the weight uom id
    • getPackageSeqIds

      public List<Integer> getPackageSeqIds()
      Gets package seq ids.
      Returns:
      the package seq ids
    • setPackageWeight

      public void setPackageWeight(int packageSeqId, BigDecimal packageWeight)
      Sets package weight.
      Parameters:
      packageSeqId - the package seq id
      packageWeight - the package weight
    • getPackageWeight

      public BigDecimal getPackageWeight(int packageSeqId)
      Gets package weight.
      Parameters:
      packageSeqId - the package seq id
      Returns:
      the package weight
    • addToPackageWeight

      public void addToPackageWeight(int packageSeqId, BigDecimal weight)
      Add to package weight.
      Parameters:
      packageSeqId - the package seq id
      weight - the weight
    • setShipmentBoxType

      public void setShipmentBoxType(int packageSeqId, String shipmentBoxType)
      Sets shipment box type.
      Parameters:
      packageSeqId - the package seq id
      shipmentBoxType - the shipment box type
    • getShipmentBoxType

      public String getShipmentBoxType(int packageSeqId)
      Gets shipment box type.
      Parameters:
      packageSeqId - the package seq id
      Returns:
      the shipment box type